Skip to content

Commit

Permalink
Setting the terminal colour to :default is special
Browse files Browse the repository at this point in the history
It is worth taking note of the fact that the "default" colour in a
terminal can be set with the -9 ANSI codes. Without this, dodgy control
codes can be emitted when the current default face is changed, resulting
in visual artifacts.
  • Loading branch information
tecosaur committed Oct 29, 2023
1 parent 2709150 commit 38ae1b3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ function termcolor(io::IO, color::SimpleColor, category::Char)
else
termcolor8bit(io, color.value, category)
end
elseif color.value === :default
print(io, "\e[", category, "9m")
elseif (fg = get(FACES.current[], color.value, getface()).foreground) != SimpleColor(color.value)
termcolor(io, fg, category)
else
Expand Down

0 comments on commit 38ae1b3

Please sign in to comment.