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

Should Themes be concatenable ? #140

Open
Nyan11 opened this issue Apr 29, 2024 · 1 comment
Open

Should Themes be concatenable ? #140

Nyan11 opened this issue Apr 29, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@Nyan11
Copy link
Collaborator

Nyan11 commented Apr 29, 2024

Hello,

I have a suggestion of enhancement of ToStyleSheetTheme: concatenation of themes

Example

I have a Theme specialize in Buttons and i have a Theme specialize in Lists. I want a Theme specialized in Buttons and Lists.

Currently i should create a new theme class and add manually the style rules and the tokens for the Buttons and the style rules and the tokens for the Lists.

With concatenation: I concatenate the theme Buttons and the theme Lists in a variable.

buttonsTheme := MyButtonsTheme new.
listsTheme := MyListsTheme new.

buttonsAndListsTheme := buttonsTheme , listsTheme.

Use cases

multiple applications with small modifications.

I create application A with my main theme and a specialized theme for application A.
I create application B with my main theme and a specialized theme for application B.

If i update my main theme, the applicaiton A and application B will be updated since they have a the same main theme.

managing simplier theme classes

We could imagine having a theme composed of the theme Buttons, the theme Lists, the theme Panel, the theme Header, ...
We have multiple small themes inside the main theme.
I personnaly think smaller classes will be easier to understand and modify.

common tokens between multiple theme.

The concatenation will combine the styleRules collection but also the theme tokens.
The last Theme in the concatenation will have the priority to modify the value of a token.
We could use this property to update the default value of a concatenated theme.
The last theme we concatenate contains the default tokens values, like for example the primary color.

lightTheme := MyButtonsTheme new , MyListsTheme new , MyLightColorTheme new.
darkTheme := MyButtonsTheme new , MyListsTheme new , MyDarkColorTheme new.

What do you think of this idea ?

@Nyan11 Nyan11 added the enhancement New feature or request label Apr 29, 2024
@plantec
Copy link
Collaborator

plantec commented Apr 29, 2024

this could be done at stylesheet level I think

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants