scriptkavi / hooks

Empower your react project with accessible and customizable hooks. Copy paste the modern hooks and use them in your React or NextJS applications.
https://hooks.scriptkavi.com
MIT License
153 stars 3 forks source link

[feature] is-dark-mode — know if user has applied/requested dark mode with system/client side. #3

Closed iamkarshe closed 2 months ago

iamkarshe commented 3 months ago

Feature description

Using useHasDarkMode know if user has dark mode already being used in client side so we can directly apply dark theme variant on load.

Some code which can help us in making this feature.

Affected component/components

No response

Additional Context

No response

Before submitting

iamkarshe commented 3 months ago

I guess we can use useMediaQuery but I thought we can provide one abstract-level for Dark mode specific hook.

https://hooks.scriptkavi.com/docs/hooks/media-query

iamkarshe commented 3 months ago

Kind of preferred-language we can have preferred-mode https://hooks.scriptkavi.com/docs/hooks/preferred-language

const mode = usePreferredScreenMode() // ['system-light', 'system-dark', 'light', 'dark']
sunnynk19 commented 3 months ago

Hi @iamkarshe , Makes sense. We can work on it. If possible, you can raise a pull request if you have the hook already available. Or I can do it when I get time.

Thanks for the suggestion.

sunnynk19 commented 2 months ago

This issue has been automatically closed because it received no activity for a while. If you think it was closed by accident, please leave a comment. Thank you.