Skip to content

Commit

Permalink
docs: 4bitcss /HowTo/JavaScript ( Fixes #101 )
Browse files Browse the repository at this point in the history
  • Loading branch information
James Brundage committed Oct 26, 2024
1 parent 7bc5112 commit d28e9c7
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions docs/HowTo/JavaScript.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
layout: none
---

<h3 style='text-align:center'>JavaScript</h3>

~~~javascript
const body = window.getQuerySelector("body");
var foregroundValue = getComputedStyle(body).getPropertyValue('--foreground');
console.log(foregroundValue);
const colorHexPreview = document.getElementById('ColorHexPreview')
colorHexPreview.value = foregroundValue;
~~~

<div style='text-align:center'>
<script>
var body = document.querySelector("body");
var foregroundValue = getComputedStyle(body).getPropertyValue('--foreground');
console.log(foregroundValue);
var colorHexPreview = document.getElementById('ColorHexPreview');
colorHexPreview.value = foregroundValue;
var colorHexPreviewText = document.getElementById('ColorHexPreviewText')
colorHexPreviewText.value = foregroundValue;
</script>
<input type='color' id='ColorHexPreview' />
<input type='text' id='ColorHexPreviewText' />
</div>

0 comments on commit d28e9c7

Please sign in to comment.