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

Add selector option to Theme config #35

Open
mertsincan opened this issue Feb 11, 2025 · 0 comments
Open

Add selector option to Theme config #35

mertsincan opened this issue Feb 11, 2025 · 0 comments
Assignees
Labels
Package: Styled name: @primeuix/styled Type: New Feature Issue contains a new feature or new module request
Milestone

Comments

@mertsincan
Copy link
Member

mertsincan commented Feb 11, 2025

The darkModeSelector can be deprecated. A possible new approach could be:

Types;

interface SelectorOptions {
    /**
     * @default ':root'
     */
    default?: string;
    /**
     * @default ':root' | '@media (prefers-color-scheme: light)'  | '@media (prefers-color-scheme: light) { :root { [CSS] } }'
     */
    light?: 'none' | string | boolean;
    /**
     * @default '@media (prefers-color-scheme: dark)' | '@media (prefers-color-scheme: dark) { :root { [CSS] } }'
     */
    dark?: 'none' | string | boolean;
}

/**
 * @default 'system'
 */
declare type Selector = 'system' | 'none' | SelectorOptions;

Usages;

options: {
    selector: 'system' // shorthand to set default value
    ...
}
options: {
    selector: 'none' // { default: ':root', light: 'none', dark: 'none' }
    ...
}
options: {
    selector: {
        light: '.lightClass',
        dark: '.darkClass'
    },
    ...
}
options: {
    selector: {
        light: '@scope (.lightClass)', // OR '@scope (.lightClass){ :scope { [CSS] } }'
        dark: '@scope (.darkClass)' // OR '@scope (.darkClass){ :scope { [CSS] } }'
    } ,
    ...
}
@mertsincan mertsincan added Package: Styled name: @primeuix/styled Type: New Feature Issue contains a new feature or new module request labels Feb 11, 2025
@mertsincan mertsincan self-assigned this Feb 11, 2025
@mertsincan mertsincan added this to the Future milestone Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: Styled name: @primeuix/styled Type: New Feature Issue contains a new feature or new module request
Projects
None yet
Development

No branches or pull requests

1 participant