Skip to content

Instantly share code, notes, and snippets.

@bfgeek
Last active November 9, 2017 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bfgeek/6e915f873eb30ed5e4e20e14a73cd5cb to your computer and use it in GitHub Desktop.
Save bfgeek/6e915f873eb30ed5e4e20e14a73cd5cb to your computer and use it in GitHub Desktop.
<style>
body {
--foo: red;
--foo: green;
--bar: red;
--bar: 42;
--quix: 42;
--quix: red;
}
</style>
<body>
<script>
CSS.registerProperty({
name: '--foo',
syntax: '<color>',
initialValue: 'black',
inherit: false
});
CSS.registerProperty({
name: '--bar',
syntax: '<color>',
initialValue: 'black',
inherit: false
});
CSS.registerProperty({
name: '--quix',
syntax: '<color>',
initialValue: 'black',
inherit: false
});
console.log('--foo: ' + getComputedStyle(document.body).getPropertyValue('--foo'));
console.log('--bar: ' + getComputedStyle(document.body).getPropertyValue('--bar'));
console.log('--quix: ' + getComputedStyle(document.body).getPropertyValue('--quix'));
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment