diff options
| author | Julie Lala <jules@okfoc.us> | 2015-05-18 19:20:32 +0200 |
|---|---|---|
| committer | Julie Lala <jules@okfoc.us> | 2015-05-18 19:20:32 +0200 |
| commit | dbd9e90652c03da3e8a65c35f3cefd8b2954b253 (patch) | |
| tree | 917db019775072a20d6cbda41e2f996cd64d2099 /js | |
| parent | b1260ec54779359ac866bd9465788aca18351e2c (diff) | |
reveal fill color as brush border color
Diffstat (limited to 'js')
| -rw-r--r-- | js/color.js | 6 | ||||
| -rw-r--r-- | js/ui/palette.js | 8 |
2 files changed, 11 insertions, 3 deletions
diff --git a/js/color.js b/js/color.js index f3826e8..56c0f54 100644 --- a/js/color.js +++ b/js/color.js @@ -1,4 +1,6 @@ +var fillColor = 1 // black + var color_names = ("white black dark-blue green red dark-red purple orange " + "yellow lime teal cyan blue magenta dark-gray light-gray").split(" "); @@ -54,3 +56,7 @@ var css_lookup = { 'rgb(127, 127, 127)': 'O', 'rgb(210, 210, 210)': 'P', }; +var css_reverse_lookup = {} +Object.keys(css_lookup).forEach(function(color){ + css_reverse_lookup[ css_lookup[color].charCodeAt(0) - 65 ] = color +}) diff --git a/js/ui/palette.js b/js/ui/palette.js index 63ea20e..063e4aa 100644 --- a/js/ui/palette.js +++ b/js/ui/palette.js @@ -1,5 +1,3 @@ -var fillColor = 1 // black - var palette = (function(){ var palette_index = localStorage.getItem("ascii.palette") || 1 @@ -49,6 +47,7 @@ var palette = (function(){ palette.repaint() return } + if (e.ctrlKey || e.which == 3) return brush.fg = lex.fg brush.bg = lex.bg brush.char = lex.char @@ -69,12 +68,15 @@ var palette = (function(){ brush.char = lex.char brush.opacity = lex.opacity brush.generate() + brush_rapper.style.borderColor = css_reverse_lookup[fillColor] return }) }) } - + + brush_rapper.style.borderColor = css_reverse_lookup[fillColor] + return palette })() |
