Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Theme tokens customization #129

Open
BrunnerLivio opened this issue Mar 2, 2020 · 0 comments
Open

Theme tokens customization #129

BrunnerLivio opened this issue Mar 2, 2020 · 0 comments

Comments

@BrunnerLivio
Copy link
Contributor

Description

One thing which would be an awesome addition to Playroom would be a design token / "theme variables" customizer. For example - the user should be able to modify the "primary" color of the components and "build" their custom theme right inside the Playroom editor.

UI

Here a really sh*tty drawing how this could be realized:
Selection_222

Which opens a new "sidebar", with a simple label / input feld (or color picker) for each token.

Integration

Example using a ThemeProvider
FrameComponent.js

import React from 'react';
import ThemeProvider from '../path/to/your/ThemeProvider';

export default ({ theme, children, customTheme }) => (
  <ThemeProvider theme={customTheme || theme}>{children}</ThemeProvider>
);

Example using CSS variables
FrameComponent.js

import React from 'react';
import ThemeProvider from '../path/to/your/ThemeProvider';

export default ({ theme, children, customTheme }) => {
  const tokens = Object.entries(customTheme);
  const style = tokens.map(([token, value]) => `--${token}: ${value};`.join('\n');
  return (
    <>
      <style>
      :root {
        {style}
      }
      </style>
      <ThemeProvider theme={customTheme || theme}>{children}</ThemeProvider>
    </>
  );
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants