Function
scopeColor
(
scope: string | undefined,
text: string,
theme: Theme,
)
Source from the content-addressed store, hash-verified
| 451 | } |
| 452 | |
| 453 | function scopeColor( |
| 454 | scope: string | undefined, |
| 455 | text: string, |
| 456 | theme: Theme, |
| 457 | ): Color { |
| 458 | if (!scope) return theme.foreground |
| 459 | if (scope === 'keyword' && STORAGE_KEYWORDS.has(text.trim())) { |
| 460 | return theme.scopes['_storage'] ?? theme.foreground |
| 461 | } |
| 462 | return ( |
| 463 | theme.scopes[scope] ?? |
| 464 | theme.scopes[scope.split('.')[0]!] ?? |
| 465 | theme.foreground |
| 466 | ) |
| 467 | } |
| 468 | |
| 469 | function flattenHljs( |
| 470 | node: HljsNode | string, |
Tested by
no test coverage detected