-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a real color scheme and add a legend
- Loading branch information
1 parent
9ee546f
commit 0fdbf37
Showing
6 changed files
with
76 additions
and
25 deletions.
There are no files selected for viewing
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<script lang="ts"> | ||
export let colors: string[]; | ||
export let steps: number[]; | ||
if (colors.length != steps.length + 1) { | ||
throw new Error(`There must be one more color than step`); | ||
} | ||
let ranges = []; | ||
let low = 0; | ||
for (let high of steps) { | ||
ranges.push(`${low}-${high}`); | ||
low = high; | ||
} | ||
ranges.push(`>${low}`); | ||
</script> | ||
|
||
<table> | ||
<tr> | ||
{#each colors as color} | ||
<td style:background-color={color} /> | ||
{/each} | ||
</tr> | ||
<tr> | ||
{#each ranges as range} | ||
<td>{range}</td> | ||
{/each} | ||
</tr> | ||
</table> | ||
|
||
<style> | ||
table, | ||
tr { | ||
width: 100%; | ||
} | ||
td { | ||
height: 30px; | ||
text-align: center; | ||
} | ||
</style> |
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 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 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 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