useTheme()
useTheme<
T
>(contract
?):ThemeContext
&object
Computes CSS values into DeckGL compatible formats using the optionally provided contract
This function allows for the reuse of CSS contract tokens within React context for non-CSS use cases. This ensures synchronized theming across the entire rendering stack
Type Parameters
• T extends Contract
Parameters
contract?
T
Returns
ThemeContext
& object
Example
import { genericColorVars, useTheme, type RGBA } from '@accelint/design-system';
const theme = useTheme({
colors: {
generic: genericColorVars,
},
});
new ArrowPathLayer({
id: 'layer-id',
// ...
getColor: theme.contract?.colors.generic.neutral.v01 as RGBA,
}),