Last active
December 25, 2022 09:16
-
-
Save mahozad/a8114b6145cac721f7652aa7b0732cf6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This is an example of making a CSS animated color property for | |
* the theme-switch component (https://github.com/mahozad/theme-switch). | |
* This gist is referenced in the documentation of the component. | |
* Currently, only Chromium-based browsers (Chrome, Opera, Edge, etc.) support this. | |
* See https://stackoverflow.com/a/63848864 for more information. | |
* For a real-world example, see https://mahozad.ir/android-pie-chart/ | |
* and its source code on https://github.com/mahozad/android-pie-chart/blob/website/docs/styles.css | |
*/ | |
@property --theme-switch-icon-color { | |
syntax: '<color>'; | |
initial-value: #000; | |
inherits: true; | |
} | |
:root { | |
--theme-switch-icon-color: red; | |
} | |
theme-switch { | |
transition: --theme-switch-icon-color 300ms; | |
} | |
theme-switch:hover { | |
--theme-switch-icon-color: blue; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment