stylex icon indicating copy to clipboard operation
stylex copied to clipboard

[Question] Do we have a solution for overriding any properties this with `stylex.createTheme`?

Open doiya46 opened this issue 6 months ago • 5 comments

To customize themes, the customer can configure any variables (color, font, size...) in the Settings feature and save it to the local storage and init when app start. Do we have a solution for overriding properties with stylex.createTheme?

Currently it will throw err if we use fn: theme.stylex.ts: Only static values are allowed inside of a stylex.create() call

const getOverrideColors = () => {
  // Get from localStorage or api on app init
  return {
    //
  };
};

const overrideColors = getOverrideColors();

export const darkTheme = stylex.createTheme(colors, {
  ...colorRepos,
  ...overrideColors,
});

doiya46 avatar Dec 25 '23 07:12 doiya46