* Creates a new Theme instance. * @param name The name of the theme. * @param rawMappings The raw CSSProperties mappings from a react-syntax-highlighter theme object.
(
readonly name: string,
readonly type: ThemeType,
rawMappings: Record<string, CSSProperties>,
readonly colors: ColorsTheme,
readonly semanticColors: SemanticColors,
)
| 149 | * @param rawMappings The raw CSSProperties mappings from a react-syntax-highlighter theme object. |
| 150 | */ |
| 151 | constructor( |
| 152 | readonly name: string, |
| 153 | readonly type: ThemeType, |
| 154 | rawMappings: Record<string, CSSProperties>, |
| 155 | readonly colors: ColorsTheme, |
| 156 | readonly semanticColors: SemanticColors, |
| 157 | ) { |
| 158 | this._colorMap = Object.freeze(this._buildColorMap(rawMappings)); // Build and freeze the map |
| 159 | |
| 160 | // Determine the default foreground color |
| 161 | const rawDefaultColor = rawMappings['hljs']?.color; |
| 162 | this.defaultColor = |
| 163 | (rawDefaultColor ? Theme._resolveColor(rawDefaultColor) : undefined) ?? |
| 164 | ''; // Default to empty string if not found or resolvable |
| 165 | } |
| 166 | |
| 167 | /** |
| 168 | * Gets the Ink-compatible color string for a given highlight.js class name. |
nothing calls this directly
no test coverage detected