forked from cray0000/ibm-dl-colors
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.styl
32 lines (27 loc) · 817 Bytes
/
index.styl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
@import './colors'
// Settings
$ibmDl-shortTones ?= false
$ibmDl-originalColors = {
'#00f': 'blue'
'#008000': 'green'
'#008080': 'teal'
'#800080': 'purple'
'#f0f': 'magenta'
'#f00': 'red'
'#ffa500': 'orange'
'#ff0': 'yellow'
'#808080': 'gray'
'#000': 'black'
'#fff': 'white'
}
palette(palette, tone = 'core')
// Handle short tone syntax (1 -> 10, 2 -> 20, ..., 9 -> 90, 0 -> 100)
// Since 10 can be in full and short syntax, 0 can be used as a short
// form of 100. Or if $ibmDl-shortTones set to true, 10 will resolve to 100
if tone is a 'unit' and (tone < 10 or (tone is 10 and $ibmDl-shortTones))
tone = 10 if tone is 0
tone = tone * 10
palette = '' + palette
tone = '' + tone
color = $ibmDl-originalColors[palette] || palette
return $ibmDl-palettes[color][tone]