diff options
| -rw-r--r-- | colors.html | 92 | ||||
| -rw-r--r-- | css/sally.css | 16 | ||||
| -rw-r--r-- | index.html | 17 | ||||
| -rw-r--r-- | js/color.js | 10 |
4 files changed, 114 insertions, 21 deletions
diff --git a/colors.html b/colors.html new file mode 100644 index 0000000..f5f9381 --- /dev/null +++ b/colors.html @@ -0,0 +1,92 @@ +<link rel="stylesheet" href="css/sally.css" type="text/css" charset="utf-8" /> +<link rel="stylesheet" href="css/ak.css" type="text/css" charset="utf-8" /> + +<body class="loading"> +<center> + +<div id="canvas_rapper" style="margin: 0 auto;margin-top:7%"> +</div> + +</body> +<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> +<script src="js/util.js"></script> +<script src="js/color.js"></script> +<script src="js/lex.js"></script> +<script src="js/matrix.js"></script> +<script> + +// var color_hue_order = ("black dark-blue purple dark-red red orange " + +// "yellow lime green dark-cyan cyan blue magenta dark-gray light-gray white").split(" "); + +var color_mat_order = ("dark-red red orange yellow lime cyan dark-cyan blue dark-blue purple magenta dark-red black").split(" ") + +function color_mat (i) { return colors[color_mat_order[ mod(i,color_mat_order.length) ]] } + +function lerp_color (lex, start_color, end_color, t, x, y) { + if (t < 0.2) { + lex.bg = start_color + } + else if (t < 0.4) { + lex.bg = start_color + lex.fg = end_color + lex.char = (x+y) % 2 ? " " : "x" + } + else if (t < 0.6) { + lex.bg = start_color + lex.fg = end_color + lex.char = "x" + } + else if (t < 0.8) { + if ((x+y) % 2) { + lex.bg = end_color + lex.fg = start_color + } + else { + lex.bg = start_color + lex.fg = end_color + } + lex.char = "x" + } + else if (t < 5.0) { + lex.bg = end_color + lex.fg = start_color + lex.char = (x+y) % 2 ? " " : "x" + } + else { + lex.bg = end_color + } +} + + +var grid_w = 6, grid_h = 4, across = 12 +//var grid_w = 3, grid_h = 3, across = 24 +var canvas = new Matrix (72, 35, function(x,y){ + var lex = new Lex (x,y) + + var i = floor(x / grid_w) + floor(y / grid_h) * across + var hue = floor(i / 5) + var t = (i % 5) / 5 + + var xx = x % grid_w + var yy = y % grid_h + + if (hue < 5*color_mat_order.length-1) { + var start_color = color_mat(hue) + var end_color = color_mat(hue+1) + } + else { + var start_color = gray(hue) + var end_color = gray(hue+1) + } + + if (xx != grid_w-1 && yy != grid_h-1) { + lerp_color(lex, start_color, end_color, t, xx, yy) + } + + lex.build() + return lex +}) +canvas.append(canvas_rapper) + +document.body.className = "" +</script>
\ No newline at end of file diff --git a/css/sally.css b/css/sally.css index 71029f8..61f544e 100644 --- a/css/sally.css +++ b/css/sally.css @@ -46,6 +46,22 @@ a:link, a:visited {text-decoration: none; color: #3b3740} .tool { cursor: pointer; } +.rapper { cursor: crosshair; } +body.grid span { border-right: 1px solid #444; border-top: 1px solid #444; border-bottom: 1px solid #444; } +body.grid div { border-top: 1px solid #444; border-left: 1px solid #444; } +.ed { color: #fff; } +.focused { box-shadow: inset 0 0px 3px #fff; border-color: #fff; } +.tool.focused, .ed.focused { color: white; text-decoration: underline; } +body.loading { opacity: 0; } +body { transition: 0.1s linear; } +.focused { box-shadow: inset 1px 0 2px white, inset -1px 0 2px white, inset 0 1px 2px white, inset 0 -1px 2px white; } +#shader_textarea { display: none; } +#import_textarea { font-size: 9pt; } +textarea { font-size:12pt; width: 45%; height: 300px; background: #333; color: #0f0; border: 0; font-family: 'FixedsysExcelsior301Regular'; outline: 0; border: 1px solid #333; background:#010;} +#import_rapper { display: none; } +#cursor_input { position: absolute; top: 0; right: 0; width:30px; opacity: 0; } + + @media screen and (-webkit-min-device-pixel-ratio:0) { #nvgovy{white-space:pre;} } @@ -1,22 +1,5 @@ <link rel="stylesheet" href="css/sally.css" type="text/css" charset="utf-8" /> <link rel="stylesheet" href="css/ak.css" type="text/css" charset="utf-8" /> -<style type="text/css"> - -.rapper { cursor: crosshair; } -body.grid span { border-right: 1px solid #444; border-top: 1px solid #444; border-bottom: 1px solid #444; } -body.grid div { border-top: 1px solid #444; border-left: 1px solid #444; } -.ed { color: #fff; } -.focused { box-shadow: inset 0 0px 3px #fff; border-color: #fff; } -.tool.focused, .ed.focused { color: white; text-decoration: underline; } -body.loading { opacity: 0; } -body { transition: 0.1s linear; } -.focused { box-shadow: inset 1px 0 2px white, inset -1px 0 2px white, inset 0 1px 2px white, inset 0 -1px 2px white; } -#shader_textarea { display: none; } -#import_textarea { font-size: 9pt; } -textarea { font-size:12pt; width: 45%; height: 300px; background: #333; color: #0f0; border: 0; font-family: 'FixedsysExcelsior301Regular'; outline: 0; border: 1px solid #333; background:#010;} -#import_rapper { display: none; } -#cursor_input { position: absolute; top: 0; right: 0; width:30px; opacity: 0; } -</style> <body class="loading"> diff --git a/js/color.js b/js/color.js index 42ae6b0..738ad02 100644 --- a/js/color.js +++ b/js/color.js @@ -1,13 +1,14 @@ var color_names = ("white black dark-blue green red dark-red purple orange " + "yellow lime dark-cyan cyan blue magenta dark-gray light-gray").split(" "); -var color_hue_order = ("black dark-blue purple dark-red red orange " + - "yellow lime green dark-cyan cyan blue magenta dark-gray light-gray white").split(" "); +var all_color_hue_order = ("black dark-blue purple dark-red red orange " + + "yellow lime green dark-cyan cyan blue magenta dark-gray light-gray white").split(" "); +var color_hue_order = "dark-red red orange yellow lime cyan dark-cyan blue dark-blue purple magenta".split(" "); var gray_names = ("black dark-gray light-gray white").split(" ") var fire_names = ("black dark-red red orange yellow white cyan").split(" ") var red_names = ("black dark-red red").split(" ") -var yellow_names = ("orange yellow cyan white").split(" ") +var yellow_names = ("black orange yellow white").split(" ") var green_names = ("dark-cyan green lime").split(" ") var blue_names = ("black dark-blue blue").split(" ") var purple_names = ("dark-blue purple magenta red").split(" ") @@ -17,7 +18,8 @@ var colors = {} color_names.forEach(function(name, i){ colors[name] = i }) -function hue (n) { return colors[color_hue_order[mod(n, 16)|0]] } +function all_hue (n) { return colors[color_hue_order[mod(n, 16)|0]] } +function hue (n) { return colors[color_hue_order[mod(n, 11)|0]] } function gray (n) { return colors[gray_names[mod(n, 4)|0]] } function fire (n) { return colors[fire_names[mod(n, 7)|0]] } function red (n) { return colors[red_names[mod(n, 3)|0]] } |
