I would like to style Scite, so it starts up with whatever is the default style - but then I would want to change to a different style to a dark one by running a command. So, after some digging, I got to this script in sciteLuaFunctions.lua
which I mapped to a command in Tools menu:
-- http://scite.ruteam.ru/archive/1.59
local function encodeRGB(color)
if string.sub(color,1,1)=="#" and string.len(color)>6 then
return tonumber(string.sub(color,6,7)..string.sub(color,4,5)..string.sub(color,2,3), 16)
else
return color
end
end
function ChangeToDarkTheme()
-- http://www.scintilla.org/PaneAPI.html
-- http://www.scintilla.org/SciTEFAQ.html " How do I change SciTE to use black as the background colour?"
-- http://www.scintilla.org/SciTEDoc.html
-- color calculation works like this:
--~ mycolorRGB = { r = 100, g = 100, b = 100 } -- ok
--~ mycolor = (mycolorRGB.r+(mycolorRGB.g*256)+(mycolorRGB.b*65536)) -- ok
-- but also can use encodeRGB:
myBackgroundColor = encodeRGB("#282C34")
editor.StyleBack[32] = myBackgroundColor -- mods background, but where there no text
editor.StyleBack[33] = myBackgroundColor -- mods background of line numbers
end
Then, when I run this command, I get something like this:
The problem is:
- The default background changes only the background not taken up by (text) characters (including linefeeds/empty lines); I would like to modify this background color too
- EDIT: Thanks to comment by @EgorSkriptunoff, managed to get (by manually experimenting with values) the entire background (at least while editing
sciteLuaFunctions.lua
, so forlua
syntax coloring, but also forcpp
it works) in the same color with this:
... except, I cannot tell where are the styles 2, 4, 5, 6 etc documented, as they are not in the FAQ or the other docs linked in the snippet above ?! So is there a list of numeric styles somewhere, and what they change?editor.StyleBack[32] = myBackgroundColor -- mods background, but where there no text editor.StyleBack[33] = myBackgroundColor -- mods background of line numbers editor.StyleBack[0] = myBackgroundColor -- mods background of whitespace/indents editor.StyleBack[2] = myBackgroundColor -- mods background of commented lines editor.StyleBack[4] = myBackgroundColor -- mods background of numbers at uncommented lines editor.StyleBack[5] = myBackgroundColor -- mods background of reserved keywords (function) at uncommented lines editor.StyleBack[6] = myBackgroundColor -- mods background of strings ("...") at uncommented lines editor.StyleBack[10] = myBackgroundColor -- mods background of equal signs, etc at uncommented lines editor.StyleBack[11] = myBackgroundColor -- mods background of regular variables at uncommented lines editor.StyleBack[14] = myBackgroundColor -- mods background of predef functions (string.sub) at uncommented lines
- EDIT: Thanks to comment by @EgorSkriptunoff, managed to get (by manually experimenting with values) the entire background (at least while editing
- If I then open a new tab, the new styling disappears - if I go back to the previous tab, the new styling disappears as well; I would instead like for the style to persist until either explicitly reset by a script, or until shutdown.
Is it possible to achieve these with a Lua script, and if so, how?