(config: Theme)
| 114 | } |
| 115 | |
| 116 | export function getCSSFilterValue(config: Theme): string | null { |
| 117 | const filters: string[] = []; |
| 118 | |
| 119 | if (config.mode === FilterMode.dark) { |
| 120 | filters.push('invert(100%) hue-rotate(180deg)'); |
| 121 | } |
| 122 | if (config.brightness !== 100) { |
| 123 | filters.push(`brightness(${config.brightness}%)`); |
| 124 | } |
| 125 | if (config.contrast !== 100) { |
| 126 | filters.push(`contrast(${config.contrast}%)`); |
| 127 | } |
| 128 | if (config.grayscale !== 0) { |
| 129 | filters.push(`grayscale(${config.grayscale}%)`); |
| 130 | } |
| 131 | if (config.sepia !== 0) { |
| 132 | filters.push(`sepia(${config.sepia}%)`); |
| 133 | } |
| 134 | |
| 135 | if (filters.length === 0) { |
| 136 | return null; |
| 137 | } |
| 138 | |
| 139 | return filters.join(' '); |
| 140 | } |
| 141 | |
| 142 | function createLeadingRule(filterRoot: string, filterValue: string): string { |
| 143 | return [ |
no outgoing calls
no test coverage detected