Skip to content

Commit 0547e3d

Browse files
committed
fix precompilation
1 parent f9184cf commit 0547e3d

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

src/UnicodePlots.jl

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,18 +112,15 @@ include("interface/polarplot.jl")
112112
include("interface/imageplot.jl")
113113

114114
function __init__()
115-
if (terminal_24bit() || forced_24bit()) && !forced_8bit()
116-
truecolors!()
117-
USE_LUT[] ? brightcolors!() : faintcolors!()
118-
else
119-
colors256!()
120-
faintcolors!()
121-
end
115+
forced_24bit() && return init_24bit()
116+
forced_8bit() && return init_8bit()
117+
Base.get_have_truecolor() ? init_24bit() : init_8bit()
122118
nothing
123119
end
124120

125121
# COV_EXCL_START
126122
function precompile_workload(io::IO = IOContext(devnull, :color => Base.get_have_color()))
123+
__init__()
127124
surf(x, y) = sinc((x^2 + y^2))
128125
for T in ( # most common types
129126
Float64,

src/common.jl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,17 @@ end
240240
brightcolors!() = COLOR_CYCLE[] = COLOR_CYCLE_BRIGHT
241241
faintcolors!() = COLOR_CYCLE[] = COLOR_CYCLE_FAINT
242242

243-
# see gist.github.com/XVilka/8346728#checking-for-colorterm
244-
terminal_24bit() = lowercase(get(ENV, "COLORTERM", "")) ("24bit", "truecolor")
243+
function init_24bit()
244+
truecolors!()
245+
USE_LUT[] ? brightcolors!() : faintcolors!()
246+
nothing
247+
end
248+
249+
function init_8bit()
250+
colors256!()
251+
faintcolors!()
252+
nothing
253+
end
245254

246255
# specific to UnicodePlots
247256
forced_24bit() = lowercase(get(ENV, "UP_COLORMODE", "")) ("24", "24bit", "truecolor")

0 commit comments

Comments
 (0)