Because Iām seeing those green ticks with the timing indicator next to this, is this actually Jupyter notebook in VSCode rather than the terminal in VSCode?
Iām a newby and clueless. What I understend is the code that has the ām\e[ā insted of ā;ā works correctly both in console and VSCode.Jupyter
println("\e[38;2;255;255;0;48;2;0;0;255mThis must have blue background\e[0m")
println("\e[38;2;255;255;0m\e[48;2;0;0;255mThis must have blue background\e[0m")
I wrote some utilities to encapsulate the setting of foreground and background colors for consoles. Tested on Win10.
module CS
u2c(v)::UInt8 = round(clamp(v, 0, 1) * 255)
c2s(RGB) = "$(u2c(RGB.r));$(u2c(RGB.g));$(u2c(RGB.b))"
fc(c::RGB) = "\e[38;2;$(c2s(c))m" #set foreground color
bc(c::RGB) = "\e[48;2;$(c2s(c))m" #set background color
fc(c) = "\e[38;5;$(clamp(c,0,255))m" #set foreground color
bc(c) = "\e[48;5;$(clamp(c,0,255))m" #set background color
fb0() = "\e[0m" #reset foreground and background color
end
for v in 0:15 print("$(CS.fc(16-v))$(CS.bc(v))*") end; println(CS.fb0())
for v in 0:15 print("$(CS.fc(v))*") end; println(CS.fb0())
for v in 0:15 print("$(CS.bc(v))*") end; println(CS.fb0())
for v in 0:1/16:0.99 print("$(CS.fc(RGB(v,v,0)))$(CS.bc(RGB(0,v,0)))*") end; println(CS.fb0())
for v in 0:1/16:0.99 print("$(CS.fc(RGB(v,v,0)))*") end; println(CS.fb0())
for v in 0:1/16:0.99 print("$(CS.bc(RGB(0,v,0)))*") end; println(CS.fb0())