summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2017-03-24 22:10:04 +0100
committerJules Laplace <jules@okfoc.us>2017-03-24 22:10:04 +0100
commita4bb7570a5ba91122c464a586efc5a897bef015b (patch)
treec0827c4e94b48ace05b09b5009ffa1aa52a849ed /js
parentef888cdb9f8d970eb95e77f17a7d66b755882cf0 (diff)
dither blocks in their own file
Diffstat (limited to 'js')
-rw-r--r--js/dither.js15
-rw-r--r--js/ui/palette.js2
2 files changed, 16 insertions, 1 deletions
diff --git a/js/dither.js b/js/dither.js
new file mode 100644
index 0000000..37baf01
--- /dev/null
+++ b/js/dither.js
@@ -0,0 +1,15 @@
+var dither = {
+ aa: '▓▒░ ',
+ a: '▓',
+ b: '▒',
+ c: '░',
+ d: ' ',
+ p: function(n){
+ if (0 <= 0 && n < 1) {
+ return block.aa[Math.floor(n * 4)]
+ }
+ else {
+ return block.aa[Math.floor(n % 4)]
+ }
+ }
+}
diff --git a/js/ui/palette.js b/js/ui/palette.js
index 5931543..40da8b6 100644
--- a/js/ui/palette.js
+++ b/js/ui/palette.js
@@ -8,7 +8,7 @@ var palette = (function(){
var palette_index = localStorage.getItem("ascii.palette") || 1
var palette_list = [all_hue, all_inv_hue, mirc_color, mirc_color_reverse]
var palette_fn = palette_list[palette_index]
- palette.chars = " ▓▒░"
+ palette.chars = " " + dither.a + dither.b + dither.c
palette.repaint = function(){
var xw = use_experimental_palette ? 5 : 2