( type: 'light' | 'dark', custom?: [string, string][] )
| 144 | }; |
| 145 | |
| 146 | const prepareCustomColors = ( |
| 147 | type: 'light' | 'dark', |
| 148 | custom?: [string, string][] |
| 149 | ) => { |
| 150 | if (!custom?.length) { |
| 151 | return {}; |
| 152 | } |
| 153 | |
| 154 | let customColors: Record<string, string> = {}; |
| 155 | |
| 156 | for (let [name, value] of custom) { |
| 157 | if (name) { |
| 158 | const customColor = argbThemeToRgbTheme(argbThemeFromColor(value, type)); |
| 159 | const camelName = camelCase(name); |
| 160 | const PascalName = camelCase(name, { pascalCase: true }); |
| 161 | |
| 162 | customColors[camelName] = customColor.primary; |
| 163 | customColors[`on${PascalName}`] = customColor.onPrimary; |
| 164 | customColors[`${camelName}Container`] = customColor.primaryContainer; |
| 165 | customColors[`on${PascalName}Container`] = customColor.onPrimaryContainer; |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | return customColors; |
| 170 | }; |
| 171 | |
| 172 | export const prepareVariant = ({ |
| 173 | primary, |
no test coverage detected
searching dependent graphs…