Skip to content

Create color selection hooks #510

@acelaya

Description

@acelaya

There is currently a brandColor and brandColorAlpha function which return the brand color based on the active theme.

However, when used in components, changing the theme does not cause a re-render, as it only changes a data attribute in the html element.

Provide custom hooks which observe the changing of this attribute and update a piece of state, so that changing the theme updates components using colors based on the theme.

Provide also a generic hook which accepts the light and dark colors to be provided, so that consumers can use them for any arbitrary combination of two colors.

const brandColor = useBrandColor();
const someColor = useColor(lighColor, darkColor);
```

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions