traefik / traefik/faency

[RFC] How should theme be extended

Open
#244 0 comments 0 reactions 3 assignees View on GitHub

@gndz07 is already working on this.

Since Jan 18, 2022.

area/documentation kind/proposal
Dominant language
TypeScript
Stars
41
Forks
16
Avg merge
3d 1h
Merged PRs (30d)
3

Description

Goals
  • Allow easy extension of our theme configuration
  • Allow following our pattern with specific theming per component
Background

Currently, we export our theme configuration and our custom color themes (dark/light)

image

We also export createTheme to allow other projects creating their own theme or completely overriding the ones we produced.

❎ We do not export a simple way to extend our already defined dark and light themes.

From stitches doc, I see no way to extend themes.

They only show how to extend the default theme returned by createStitches with createTheme.

Proposals
  1. Should we create custom local themes when we need per component extensions ?
import customThemeConfig from './CustomElement.themes.ts';

const CustomElement: () => JSX.Element = ...;

const customElementTheme = createTheme(..., {

...customThemeConfig, // somehow we add the custom theme config
});

const CustomElementWithTheme = () => {
  return (
    <div className={customElementTheme}>
      <CustomElement />
    </div>
  );
}

export default CustomElementWithTheme

I fear we might lose dark/light themes for the specific component's context to gain our custom config.

NB: I don't really like this option so far.

  1. Maybe we could expose a way to extend dark and light themes easily?
export const extendTheme: (existingTheme: 'dark' | 'light') => ReturnType<typeof createTheme>

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.