diff --git a/Nasal/canvas/api.nas b/Nasal/canvas/api.nas index 0b5cdc24f..f1bdf5954 100644 --- a/Nasal/canvas/api.nas +++ b/Nasal/canvas/api.nas @@ -18,6 +18,7 @@ var include_path = "Nasal/canvas/api/"; # log level for debug output var _API_dbg_level = DEV_WARN; +io.include(include_path~"colors.nas"); io.include(include_path~"helpers.nas"); io.include(include_path~"transform.nas"); io.include(include_path~"element.nas"); diff --git a/Nasal/canvas/api/colors.nas b/Nasal/canvas/api/colors.nas new file mode 100644 index 000000000..6092fae8a --- /dev/null +++ b/Nasal/canvas/api/colors.nas @@ -0,0 +1,24 @@ +#------------------------------------------------------------------------------- +# colors.nas +#------------------------------------------------------------------------------- + +colors = { + black: [0, 0, 0], + white: [1, 1, 1], + grey25: [0.25, 0.25, 0.25], + grey50: [0.5, 0.5, 0.5], + grey75: [0.75, 0.75, 0.75], + + red: [1, 0, 0], + green: [0, 1, 0], + blue: [0, 0, 1], + cyan: [0, 1, 1], + magenta: [1, 0, 1], + yellow: [1, 1, 0], + + lightblue: [0, 0.5, 1], + purple: [0.5, 0, 1], + orange: [1, 0.5, 0], + + amber: [1, 0.682, 0], +}; diff --git a/Nasal/canvas/draw/draw.nas b/Nasal/canvas/draw/draw.nas index b709d66b9..0a6b89ae8 100644 --- a/Nasal/canvas/draw/draw.nas +++ b/Nasal/canvas/draw/draw.nas @@ -141,20 +141,6 @@ var draw = { #aliases draw.diamond = draw.rhombus; -draw.colors = { - white: [1, 1, 1], - grey50: [0.5, 0.5, 0.5], - grey25: [0.25, 0.25, 0.25], - black: [0, 0, 0], - red: [1, 0, 0], - green: [0, 1, 0], - blue: [0, 0, 1], - cyan: [0, 1, 1], - magenta: [1, 0, 1], - yellow: [1, 1, 0], - orange: [1, 0.5, 0], -}; - #base class for styles draw.style = { new: func() { diff --git a/Nasal/modules/canvas_efis/efis-canvas.nas b/Nasal/modules/canvas_efis/efis-canvas.nas index ba945fe44..e90c86915 100644 --- a/Nasal/modules/canvas_efis/efis-canvas.nas +++ b/Nasal/modules/canvas_efis/efis-canvas.nas @@ -33,7 +33,7 @@ var EFISCanvas = { me._timers = []; }, - colors: EFIS.colors, + colors: canvas.colors, defaultcanvas_settings: EFIS.defaultcanvas_settings, new: func(name, svgfile=nil) { diff --git a/Nasal/modules/canvas_efis/efis.nas b/Nasal/modules/canvas_efis/efis.nas index 10b93acbc..6adc7542d 100644 --- a/Nasal/modules/canvas_efis/efis.nas +++ b/Nasal/modules/canvas_efis/efis.nas @@ -27,17 +27,7 @@ var EFIS = { window_size: [450,450], - colors: { - transparent: [1,0,0,0], - white: [1,1,1], - red: [1,0,0], - green : [0,1,0], - blue : [0,0,1], - yellow: [1,1,0], - cyan: [0,1,1], - magenta: [1,0,1], - amber: [1,0.682,0], - }, + colors: canvas.colors, del: func() { },