@@ -152,8 +152,8 @@ const SUPERSCRIPT = Dict(
152
152
# ###########################################################################################
153
153
# define types
154
154
const MarkerType = Union{Symbol,AbstractChar,AbstractString}
155
- const StyledStringsColorType = Union{Integer, Symbol,StyledStrings. RGBTuple,UInt32}
156
- const UserColorType = Union{StyledStrings. Face,StyledStringsColorType,NTuple{ 3 ,Integer}, Nothing} # allowed color type
155
+ const StyledStringsColorType = Union{Symbol,StyledStrings. RGBTuple,NTuple{ 3 ,Integer}, UInt32} # from StyledStrings/src/faces.jl
156
+ const UserColorType = Union{StyledStrings. Face,StyledStringsColorType,Nothing} # allowed color type
157
157
const ColorType = UInt32 # internal UnicodePlots color type (on canvas), 8bit or 24bit
158
158
159
159
# ###########################################################################################
@@ -214,6 +214,21 @@ const DEFAULT_WIDTH = Ref(round(Int, DEFAULT_HEIGHT[] * 2ASPECT_RATIO[]))
214
214
brightcolors! () = COLOR_CYCLE[] = COLOR_CYCLE_BRIGHT
215
215
faintcolors! () = COLOR_CYCLE[] = COLOR_CYCLE_FAINT
216
216
217
+ colors256! () = COLORMODE[] = COLORMODE_8BIT
218
+ truecolors! () = COLORMODE[] = COLORMODE_24BIT
219
+
220
+ function init_24bit ()
221
+ truecolors! ()
222
+ USE_LUT[] ? brightcolors! () : faintcolors! ()
223
+ nothing
224
+ end
225
+
226
+ function init_8bit ()
227
+ colors256! ()
228
+ faintcolors! ()
229
+ nothing
230
+ end
231
+
217
232
colormode () =
218
233
if (cm = COLORMODE[]) ≡ COLORMODE_8BIT
219
234
8
@@ -223,9 +238,6 @@ colormode() =
223
238
throw (ArgumentError (" color mode $cm is unsupported" ))
224
239
end
225
240
226
- colors256! () = COLORMODE[] = COLORMODE_8BIT
227
- truecolors! () = COLORMODE[] = COLORMODE_24BIT
228
-
229
241
function colormode! (mode)
230
242
if mode ≡ 8
231
243
colors256! ()
@@ -237,7 +249,6 @@ function colormode!(mode)
237
249
nothing
238
250
end
239
251
240
-
241
252
# specific to UnicodePlots
242
253
forced_24bit () = lowercase (get (ENV , " UP_COLORMODE" , " " )) ∈ (" 24" , " 24bit" , " truecolor" )
243
254
forced_8bit () = lowercase (get (ENV , " UP_COLORMODE" , " " )) ∈ (" 8" , " 8bit" )
0 commit comments