typemytype / drawbot

http://www.drawbot.com
Other
398 stars 61 forks source link

Assigning a color theme programmatically? #494

Open frankrolf opened 1 year ago

frankrolf commented 1 year ago

I like the idea of Dark Mode DrawBot, but it’s difficult to change the theme manually. Is there a way to switch the syntax highlighting colors programmatically?

Thanks! :-)

typemytype commented 1 year ago

like setting the prefs? yes you can

from drawBot.misc import getDefault, setDefault

colors = dict(getDefault("PyDETokenColors", dict()))
print(colors)

if that value is empty you never have change any colors in the prefs.

just in case these are all the colors keys: Token.Name.Decorator, Token.Literal.String, Token.Generic.Heading, Token.Literal.Number.Oct, Token.Text, Token.Name, Token.Name.Tag, Token.Operator, Token.Error, Token.Name.Constant, Token.Name.Builtin.Pseudo, Token.Punctuation, Token.Keyword.Namespace, Token.Name.Namespace, Token.Comment, Token.Generic.Strong, Token, Token.Keyword, Token.Literal.Number.Hex, Token.Name.Exception, Token.Literal.Number, Token.Literal.Number.Float, Token.Name.Function, Token.Name.Class, Token.Name.Variable, Token.Name.Attribute, Token.Operator.Word, Token.Literal.String.Doc, Token.Name.Builtin, Token.Generic.Subheading, Token.Generic.Emph

and use PyDEBackgroundColor and PyDEHightLightColor for the background and highlight colors

you can then bundle everything in a drawBot packages and share easily share it!!

good luck!!