All files / theme si-theme.model.ts

100% Statements 2/2
100% Branches 0/0
100% Functions 0/0
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292                                                                                                          1x   1x                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
/**
 * Copyright (c) Siemens 2016 - 2025
 * SPDX-License-Identifier: MIT
 */
/** */
export interface ThemeDescription {
  name: string;
  groups: ThemePropertyGroup[];
}
 
export interface ThemePropertyGroup {
  name: string;
  description?: string;
  properties: ThemeProperty[];
}
 
export interface ThemeProperty {
  name: string;
  usage: string;
  type: ThemePropertyType;
}
 
export type ThemePropertyType = 'color' | 'gradient' | 'font' | 'url' | 'text' | 'number';
 
export interface Theme {
  name: string;
  schemes: ThemeColorSchemes;
  /**
   * A map of icons that overrides the default Element icons.
   * The key must be the key of the original icon that should be overridden.
   * The value has to be a data SVG string.
   *
   * @example
   * ```ts
   * {
   *   elementUser: "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'>...</svg>"
   * }
   * ```
   *
   * @experimental
   */
  icons?: Record<string, string>;
}
 
export interface ThemeColorSchemes {
  light?: ThemeColorScheme;
  dark?: ThemeColorScheme;
}
 
export type ThemeColorScheme = { [key: string]: string };
 
export type ThemeType = 'dark' | 'light' | 'auto';
 
export const ELEMENT_THEME_NAME = 'element';
 
export const elementTheme: ThemeDescription = {
  name: 'element',
  groups: [
    {
      name: 'Branding',
      description: 'Configure the brand logo.',
      properties: [
        {
          name: '--element-brand-logo',
          usage: 'Enter a brand logo in the format: \'url("https://company/logo.svg")\'',
          type: 'text'
        },
        {
          name: '--element-brand-logo-width',
          usage: "Enter the width of the logo as CSS width value. Example: '100px'",
          type: 'text'
        },
        {
          name: '--element-brand-logo-height',
          usage: "Enter the height of the logo as CSS width value. Max: 48px; Example: '16px'",
          type: 'text'
        },
        {
          name: '--element-brand-logo-text',
          usage:
            'Enter a textual representation of the logo. Example: \'"Siemens logo"\'. The text must be wrapped in double quotes.',
          type: 'text'
        }
      ]
    },
    {
      name: 'Basic definitions',
      description: 'Basic definitions',
      properties: [
        {
          name: '--element-body-font-family',
          usage: 'The theme only uses one font everywhere.',
          type: 'font'
        },
        { name: '--element-button-radius', usage: 'Button border radius', type: 'text' },
        { name: '--element-button-focus-width', usage: 'Focus width', type: 'text' },
        {
          name: '--element-button-focus-overlay-width',
          usage: 'Focus overlay width',
          type: 'text'
        },
        {
          name: '--element-button-focus-overlay-color',
          usage: 'Focus overlay color',
          type: 'text'
        },
        { name: '--element-input-radius', usage: 'Input field border radius', type: 'text' },
        { name: '--element-logo-color', usage: 'Logo color', type: 'text' },
        { name: '--element-radius-1', usage: 'Border radius-1', type: 'text' },
        { name: '--element-radius-2', usage: 'Border radius-2', type: 'text' },
        { name: '--element-radius-3', usage: 'Border radius-3', type: 'text' }
      ]
    },
    {
      name: 'UI',
      description:
        'UI colors are used on structural properties and icons and provide good contrast when used over any background.',
      properties: [
        { name: '--element-ui-0', usage: 'Logo, selected (active) elements', type: 'color' },
        { name: '--element-ui-0-hover', usage: 'Selected hover', type: 'color' },
        { name: '--element-ui-1', usage: 'Primary icons', type: 'color' },
        { name: '--element-ui-2', usage: 'Secondary icons', type: 'color' },
        { name: '--element-ui-3', usage: 'Disabled', type: 'color' },
        { name: '--element-ui-4', usage: 'Borders', type: 'color' },
        { name: '--element-ui-5', usage: 'Inverse', type: 'color' },
        { name: '--element-ui-6', usage: 'Shadows', type: 'color' },
        { name: '--element-box-shadow-color-1', usage: 'Box shadow color 1', type: 'color' },
        { name: '--element-box-shadow-color-2', usage: 'Box shadow color 2', type: 'color' },
        { name: '--element-focus-default', usage: 'Default focus color', type: 'color' }
      ]
    },
    {
      name: 'Base',
      description: 'Base colors are used as backgrounds of containers.',
      properties: [
        { name: '--element-base-0', usage: 'Page background, row background', type: 'color' },
        {
          name: '--element-base-1',
          usage: 'Header, navigation, card, table background',
          type: 'color'
        },
        {
          name: '--element-base-1-hover',
          usage: 'Hover on base-1 backgrounds, like table, tree, or menu',
          type: 'color'
        },
        {
          name: '--element-base-1-selected',
          usage: 'Selected on base-1 backgrounds, like table, tree, or menu',
          type: 'color'
        },
        {
          name: '--element-base-2',
          usage: 'Page background with higher contrast pages in dark mode',
          type: 'color'
        },
        {
          name: '--element-base-information',
          usage: 'Informational component background for e.g. badges',
          type: 'gradient'
        },
        {
          name: '--element-base-success',
          usage: 'Success component background for e.g. badges',
          type: 'gradient'
        },
        {
          name: '--element-base-caution',
          usage: 'Caution component background for e.g. badges',
          type: 'gradient'
        },
        {
          name: '--element-base-warning',
          usage: 'Warning component background for e.g. badges',
          type: 'gradient'
        },
        {
          name: '--element-base-danger',
          usage: 'Danger component background for e.g. badges',
          type: 'gradient'
        },
        {
          name: '--element-base-translucent-1',
          usage: 'Translucent background, e.g. backdrop',
          type: 'gradient'
        },
        {
          name: '--element-base-translucent-2',
          usage: 'Slightly translucent background, e.g. toasts',
          type: 'gradient'
        }
      ]
    },
    {
      name: 'Actions',
      description: 'Action colors are used to indicate actions that users can perform.',
      properties: [
        { name: '--element-action-primary', usage: 'Primary interaction', type: 'gradient' },
        {
          name: '--element-action-primary-hover',
          usage: 'Primary action background on hover',
          type: 'gradient'
        },
        { name: '--element-action-primary-text', usage: 'Primary text color', type: 'color' },
        { name: '--element-action-secondary', usage: 'Secondary interaction', type: 'gradient' },
        {
          name: '--element-action-secondary-hover',
          usage: 'Secondary action background on hover',
          type: 'gradient'
        },
        { name: '--element-action-secondary-text', usage: 'Secondary text color', type: 'color' },
        {
          name: '--element-action-secondary-text-hover',
          usage: 'Secondary text color on hover',
          type: 'color'
        },
        {
          name: '--element-action-secondary-border',
          usage: 'Secondary border color',
          type: 'color'
        },
        {
          name: '--element-action-secondary-border-hover',
          usage: 'Secondary border color on hover',
          type: 'color'
        },
        { name: '--element-action-warning', usage: 'Warning', type: 'gradient' },
        {
          name: '--element-action-warning-hover',
          usage: 'Warning action background on hover',
          type: 'gradient'
        },
        { name: '--element-action-warning-text', usage: 'Warning text color', type: 'color' },
        { name: '--element-action-danger', usage: 'Danger', type: 'gradient' },
        {
          name: '--element-action-danger-hover',
          usage: 'Danger action background on hover',
          type: 'gradient'
        },
        { name: '--element-action-danger-text', usage: 'Danger text color', type: 'color' },
        {
          name: '--element-action-disabled-opacity',
          usage: 'Disabled action opacity',
          type: 'number'
        }
      ]
    },
    {
      name: 'Text',
      description: 'Similarly, categories for typography colors are also defined in this system.',
      properties: [
        { name: '--element-text-primary', usage: 'Primary', type: 'color' },
        { name: '--element-text-secondary', usage: 'Secondary', type: 'color' },
        { name: '--element-text-disabled', usage: 'Disabled', type: 'color' },
        { name: '--element-text-inverse', usage: 'Inverse', type: 'color' },
        { name: '--element-text-active', usage: 'Active', type: 'color' },
        { name: '--element-text-information', usage: 'Informational', type: 'color' },
        { name: '--element-text-success', usage: 'Success', type: 'color' },
        { name: '--element-text-caution', usage: 'Caution', type: 'color' },
        { name: '--element-text-warning', usage: 'Warning', type: 'color' },
        { name: '--element-text-danger', usage: 'Danger', type: 'color' }
      ]
    },
    {
      name: 'Status',
      description:
        'Status colors are used to describe and/or report on the status of different things.',
      properties: [
        { name: '--element-status-information', usage: 'Informational', type: 'color' },
        {
          name: '--element-status-information-contrast',
          usage: 'Informational contrast',
          type: 'color'
        },
        { name: '--element-status-success', usage: 'Success', type: 'color' },
        { name: '--element-status-success-contrast', usage: 'Success contrast', type: 'color' },
        { name: '--element-status-caution', usage: 'Caution', type: 'color' },
        { name: '--element-status-caution-contrast', usage: 'Caution contrast', type: 'color' },
        { name: '--element-status-warning', usage: 'Warning', type: 'color' },
        { name: '--element-status-warning-contrast', usage: 'Warning contrast', type: 'color' },
        { name: '--element-status-danger', usage: 'Danger', type: 'color' },
        { name: '--element-status-danger-contrast', usage: 'Danger contrast', type: 'color' }
      ]
    },
    {
      name: 'Form feedback icons',
      description: 'Icons that are used to indicate a form item status',
      properties: [{ name: '--element-invalid-feedback-icon', usage: 'Danger', type: 'text' }]
    }
  ]
};