-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
37443d1
commit ea1be9f
Showing
7 changed files
with
365 additions
and
6 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,54 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Color Ramp cheatsheet</title> | ||
<link rel="stylesheet" href="vanilla.css"> | ||
<style> | ||
.colorItem { | ||
display: inline-block; | ||
width: 1px; | ||
height: 20px; | ||
} | ||
</style> | ||
<script src="dist/index.js"></script> | ||
</head> | ||
<body> | ||
<h1>Color Ramp cheatsheet</h1> | ||
<div id="colorSchemes"></div> | ||
<script> | ||
const {colorInterpolator, colorSchemeNames} = MaplibreCOGProtocol; | ||
|
||
const rows = colorSchemeNames.map(colorScheme => { | ||
const interpolateDisc = colorInterpolator({colorScheme, min: 0,max: 230}); | ||
const discreteRamp = Array.from({length: 231}, (x, i) => { | ||
const [r, g, b] = interpolateDisc(i); | ||
return `<span class="colorItem" style="background: rgb(${r}, ${g}, ${b})"></span>`; | ||
}).join(''); | ||
|
||
const interpolateCont = colorInterpolator({colorScheme, min: 0, max: 230, isContinuous: true}); | ||
const continuousRamp = Array.from({length: 231}, (x, i) => { | ||
const [r, g, b] = interpolateCont(i); | ||
return `<span class="colorItem" style="background: rgb(${r}, ${g}, ${b})"></span>`; | ||
}).join(''); | ||
|
||
return `<tr> | ||
<td>${colorScheme}</td> | ||
<td>${discreteRamp}</td> | ||
<td>${continuousRamp}</td> | ||
</tr>`; | ||
}).join(''); | ||
|
||
document.getElementById('colorSchemes').innerHTML = `<table> | ||
<tr> | ||
<th>colorScheme</th> | ||
<th>discrete</th> | ||
<th>continuous</th> | ||
</tr> | ||
${rows} | ||
</table>`; | ||
|
||
</script> | ||
</body> | ||
</html> |
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
import cogProtocol from '@/cogProtocol'; | ||
export { cogProtocol }; | ||
import { colorInterpolator, colorSchemeNames } from '@/colorInterpolator'; | ||
export { cogProtocol, colorInterpolator, colorSchemeNames }; |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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