Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-color/light-dark-currentcolor-in-color.html - WPT Dashboard Interop Dashboard
<!doctype html>
<meta charset="utf-8">
<title>CurrentColor can be used inside light-dark for the color property</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
#parent { color: green; }
#child {
color-scheme: dark;
color: light-dark(red, currentColor);
}
</style>
<div id="parent">
<div id="child">Text should be green</div>
</div>
<script>
test(() => {
assert_equals(getComputedStyle(child).color, "rgb(0, 128, 0)");
}, "curentColor in light-dark() refers to parent color");
</script>