()
| 316 | }; |
| 317 | |
| 318 | const DynamicColorTheme = () => { |
| 319 | const [isDark, setIsDark] = useState(false); |
| 320 | |
| 321 | const [primary, setPrimary] = useState<string>(defaultColor); |
| 322 | const [secondary, setSecondary] = useState<string | undefined>(); |
| 323 | const [tertiary, setTertiary] = useState<string | undefined>(); |
| 324 | const [customColors, setCustomColors] = useState<CustomColorEntry[]>([]); |
| 325 | |
| 326 | const darkMode = isDark ? 'dark' : 'light'; |
| 327 | const baseTheme = hexThemeFromColor(primary); |
| 328 | const themes = prepareThemes({ |
| 329 | primary, |
| 330 | secondary, |
| 331 | tertiary, |
| 332 | custom: customColors.map(({ name, hex }) => [name, hex]), |
| 333 | }); |
| 334 | |
| 335 | return ( |
| 336 | <div> |
| 337 | <table className="color-picker"> |
| 338 | <tbody> |
| 339 | <BaseColor color={primary} setColor={setPrimary} /> |
| 340 | <AdditionalColor |
| 341 | color={secondary} |
| 342 | setColor={setSecondary} |
| 343 | base={baseTheme.secondary} |
| 344 | > |
| 345 | Secondary |
| 346 | </AdditionalColor> |
| 347 | <AdditionalColor |
| 348 | color={tertiary} |
| 349 | setColor={setTertiary} |
| 350 | base={baseTheme.tertiary} |
| 351 | > |
| 352 | Tertiary |
| 353 | </AdditionalColor> |
| 354 | |
| 355 | <CustomColors |
| 356 | customColors={customColors} |
| 357 | setCustomColors={setCustomColors} |
| 358 | /> |
| 359 | </tbody> |
| 360 | </table> |
| 361 | |
| 362 | <div |
| 363 | className="color-picker-preview" |
| 364 | style={{ |
| 365 | //@ts-ignore |
| 366 | background: themes[darkMode].background, |
| 367 | //@ts-ignore |
| 368 | color: themes[darkMode].onBackground, |
| 369 | //@ts-ignore |
| 370 | borderColor: themes[darkMode].outlineVariant, |
| 371 | }} |
| 372 | > |
| 373 | <div className="color-picker-preview-header"> |
| 374 | <h3>Preview</h3> |
| 375 | <div> |
nothing calls this directly
no test coverage detected
searching dependent graphs…