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

New feature: allow using CSS variables for scale values #177

Closed
jmjuanes opened this issue Aug 22, 2022 · 0 comments · Fixed by #179
Closed

New feature: allow using CSS variables for scale values #177

jmjuanes opened this issue Aug 22, 2022 · 0 comments · Fixed by #179
Labels
config Configuration issues (theme, variants, breakpoints...) css Issues related with the output css request-feature Request a new feature for siimple
Milestone

Comments

@jmjuanes
Copy link
Owner

jmjuanes commented Aug 22, 2022

Feature type

Other...

Is your feature request related to a problem?

No, this feature is needed for implementing color modes in siimple.

Describe the solution you'd like

Allow using CSS variables to store scale values defined in the configuration of siimple. We will use the :root selector to store the default scale values as a CSS variable:

:root {
    --siimple-color-primary: #1c76fd;
    --siimple-color-secondary: #3542d4;
    /* ... */
    --siimple-font-size-0: 0.875rem;
    --siimple-font-size-1: 16px;
    --siimple-font-size-2: 1.25rem;
    /* ... */
}

Then, in each style we will use the CSS variable instead of using the scale value directly:

.alert {
    color: var(--siimple-color-primary);
    /* ... */
}

This feature will be enabled by default in siimple 4.3.0, but it can be disabled by the user providing a falsy value to the useCssVariables flag in the configuration:

export default {
    useCssVariables: false,
    // ...other configuration
};

Describe alternatives you've considered

No response

Additional context

This issue is related to discussion #176.

@jmjuanes jmjuanes added config Configuration issues (theme, variants, breakpoints...) css Issues related with the output css request-feature Request a new feature for siimple labels Aug 22, 2022
@jmjuanes jmjuanes added this to the v4.3.0 milestone Aug 22, 2022
@jmjuanes jmjuanes linked a pull request Aug 24, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config Configuration issues (theme, variants, breakpoints...) css Issues related with the output css request-feature Request a new feature for siimple
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant