Some questions about editing/creating KSF files

I want to to create my own color scheme, I already know I can use Preferences and change the scheme colors with a GUI, but I want to write a color scheme from code.

Anyways, it looks straight forward enough, but I have some questions, first of all, what form are the color codes in? It’s pretty obvious they’re decimal, but are they RGB, or BGR, or something else all together? Also, does it support HEX color codes?

Second, can you create variables? So, for example, I’d be able to do ‘myColor’ : 123456, and then instead of constantly typing 123456 I could just type ‘myColor’.

Instead of writing a lot of boring info I just dare you to look at the some of my themes:

In my opinion I recommend to use the second example of the theme (because it’s has understandable colors :smile:)
Just to make you understand what is a ksf files - it’s a Python files so you can use the whole Python power but don’t forget about exports variable

Oh, haha, I didn’t realize it was just Python! :stuck_out_tongue:

Looks pretty straight forward, thanks for the quick reply!

1 Like

You could realize that if you tried to open ksf in Komodo by dragging the file onto the window and in the dialogue press Open as file :smile:
Btw I wish you a luck in creating your theme. I hope it’ll be awesome! Don’t forget to submit your theme to the Resources:

I did, but the only KSF files I could find were like this:

Version = 13

Booleans = {'caretLineVisible': True, 'preferFixed': True, 'useSelFore': False}

CommonStyles = {'attribute name': {'fore': 7481081},
'attribute value': {'fore': 3072678},
'bracebad': {'fore': 15923448},
#.... etc.

So I thought it might just be a custom configuration file.

Anyways, thanks again for the help, and I’ll definitely submit my color scheme!

I meant you could open a ksf file and see that is a Python file :smile:

I’m actually having some issues, for testing purposes I just copied values from another scheme, so that I can first get it working before I actually customize it, but it just isn’t working, when I apply the scheme nothing happens, it just keeps the previous scheme, and if I restart Komodo it overwrites the scheme with just a basic black text on white background scheme. Here’s the code I have so far:

def parseScheme():
    return {
    'Version': 1,

    'Booleans': {'caretLineVisible': False, 'preferFixed': False, 'useSelFore': True},

    'CommonStyles': {
        'attribute name': {'fore': 7872391},
        'attribute value': {'fore': 3100463},
        'bracebad': {'back': 2172710, 'bold': 1, 'fore': 16777215},
        'bracehighlight': {'back': 2172710,
        'bold': True,
        'fore': 7658727,
        'size': 13},
        'classes': {'back': 2172710, 'fore': 3007143},
        'comments': {'back': 2172710, 'fore': 6189429, 'italic': True},
        'control characters': {'back': 2172710, 'fore': 0},
        'default_fixed': {'back': 2172967,
        'bold': False,
        'eolfilled': 0,
        'face': 'Hei',
        'fore': 16777215,
        'hotspot': 0,
        'italic': False,
        'size': 13,
        'useFixed': 1},
        'default_proportional': {'back': 2238503,
        'bold': 0,
        'eolfilled': 0,
        'face': 'Monaco',
        'fore': 16777215,
        'hotspot': 0,
        'italic': 0,
        'size': 13,
        'useFixed': 0},
        'fold markers': {'back': 10197915, 'fore': 16777215},
        'functions': {'back': 2172710, 'fore': 3007143},
        'identifiers': {'back': 2172710, 'fore': 15718758, 'italic': True},
        'indent guides': {'back': 2172710, 'fore': 2370603},
        'keywords': {'back': 2172710, 'fore': 10040115},
        'keywords2': {'fore': 7872391},
        'linenumbers': {'back': 14408667, 'fore': 2172710},
        'numbers': {'fore': 8287605},
        'operators': {'fore': 3006885},
        'preprocessor': {'fore': 6908265},
        'regex': {'fore': 25800},
        'stderr': {'fore': 16711680, 'italic': 1},
        'stdin': {'fore': 0},
        'stdout': {'fore': 0},
        'stringeol': {'back': 10079487, 'eolfilled': 1, 'fore': 6710886},
        'strings': {'fore': 2069236},
        'tags': {'fore': 16724480},
        'variables': {'fore': 0}

    'LanguageStyles': {
        'Apache': {'directives': {'fore': 9145088},
        'extensions': {'fore': 139},
        'ip_addresses': {'fore': 6908265},
        'parameters': {'fore': 7872391}},
        'C#': {'UUIDs': {'fore': 0},
        'commentdockeyword': {'fore': 0},
        'commentdockeyworderror': {'fore': 14483456},
        'globalclass': {'fore': 9145088},
        'verbatim': {'fore': 0}},
        'C++': {'UUIDs': {'fore': 0},
        'commentdockeyword': {'fore': 0},
        'commentdockeyworderror': {'fore': 14483456},
        'globalclass': {'fore': 9145088},
        'verbatim': {'fore': 0}},
        'CSS': {'classes': {'fore': 15718758},
        'comments': {'fore': 6189429},
        'default': {'back': 2172967, 'fore': 16777215},
        'identifiers': {'fore': 3007143, 'italic': False},
        'ids': {'fore': 7480826},
        'important': {'fore': 6711039},
        'operators': {'fore': 16777215},
        'strings': {'fore': 16763955},
        'tags': {'fore': 13421772},
        'values': {'fore': 2070525}},
        'Diff': {'additionline': {'fore': 9109504},
        'chunkheader': {'fore': 9145088},
        'deletionline': {'fore': 139},
        'diffline': {'fore': 6908265, 'italic': 1},
        'fileline': {'fore': 7872391, 'italic': 1}},
        'Errors': {'Error lines': {'fore': 102, 'hotspot': 1, 'italic': 1}},
        'HTML': {'attribute name': {'fore': 6189429},
        'attributes': {'fore': 102},
        'cdata': {'fore': 9109504},
        'comments': {'italic': False},
        'default': {'back': 2172710, 'fore': 10263708},
        'indent guides': {'back': 6189429, 'fore': 2370603},
        'operators': {'fore': 6189429},
        'other': {'fore': 6710886},
        'pi content': {'back': 3355443, 'fore': 16777215},
        'strings': {'fore': 8164759},
        'tags': {'fore': 6189429}},
        'IDL': {'UUIDs': {'fore': 0},
        'commentdockeyword': {'fore': 0},
        'commentdockeyworderror': {'fore': 14483456},
        'globalclass': {'fore': 9145088},
        'verbatim': {'fore': 0}},
        'Java': {'UUIDs': {'fore': 0},
        'commentdockeyword': {'fore': 0},
        'commentdockeyworderror': {'fore': 14483456},
        'globalclass': {'fore': 9145088},
        'verbatim': {'fore': 0}},
        'JavaScript': {'UUIDs': {'fore': 0},
        'commentdockeyword': {'fore': 0},
        'commentdockeyworderror': {'fore': 14483456},
        'comments': {'fore': 5860206},
        'default': {'back': 2172967},
        'globalclass': {'fore': 9145088},
        'identifiers': {'fore': 3007143},
        'keywords': {'fore': 15718758},
        'numbers': {'fore': 52275},
        'operators': {'fore': 16777215, 'italic': False},
        'strings': {'fore': 2070525},
        'verbatim': {'fore': 0}},
        'PHP': {'attribute name': {'back': 3355443, 'fore': 10066329},
        'attribute value': {'back': 3355443},
        'bracebad': {'back': 1580316, 'bold': False, 'fore': 6078719},
        'bracehighlight': {'back': 1580316,
        'bold': True,
        'fore': 6078719,
        'italic': False,
        'size': 13},
        'cdata': {'back': 3355443, 'fore': 9109504},
        'comments': {'back': 2172710, 'fore': 4873825, 'italic': False},
        'control characters': {'back': 6711039, 'fore': 6711039},
        'default': {'back': 2172710, 'fore': 6627801},
        'entity references': {'back': 3355443},
        'identifiers': {'back': 2172710, 'fore': 15718758, 'italic': True},
        'indent guides': {'back': 2370603, 'fore': 2370603},
        'keywords': {'back': 2172710, 'fore': 5638908},
        'linenumbers': {'back': 14737632},
        'numbers': {'back': 2172967, 'fore': 7658727},
        'operators': {'back': 2172710,
        'bold': True,
        'fore': 16777215,
        'italic': False},
        'other': {'fore': 6710886},
        'pi content': {'back': 2044710},
        'regex': {'back': 204},
        'strings': {'back': 2172710, 'fore': 2070525},
        'tags': {'back': 3355443, 'fore': 13421772},
        'variables': {'back': 2172710, 'bold': False, 'fore': 2087828}},
        'Perl': {'arrays': {'back': 3355443, 'fore': 26112},
        'data sections': {'back': 3355443, 'fore': 6710886},
        'hashes': {'back': 3355443, 'fore': 26112},
        'here documents': {'back': 3355443, 'bold': 1, 'fore': 8594211},
        'variables': {'back': 3355443, 'fore': 39168}},
        'Python': {'bracehighlight': {'back': 6750207},
        'classes': {'back': 3355443, 'fore': 6711039},
        'comments': {'back': 3355443, 'fore': 52275},
        'decorators': {'back': 3355443},
        'default': {'back': 3355443, 'fore': 13421823},
        'functions': {'fore': 6711039},
        'identifiers': {'back': 3355443,
        'bold': False,
        'fore': 16777215,
        'useFixed': True},
        'keywords': {'bold': True, 'fore': 6737151},
        'numbers': {'fore': 10526975},
        'operators': {'bold': True, 'fore': 12632256},
        'strings': {'fore': 15125382}},
        'Regex': {'charclass': {'fore': 2237106, 'italic': 1},
        'charescape': {'fore': 9145088, 'italic': 1},
        'charset_operator': {'fore': 7872391, 'size': 12},
        'comment': {'fore': 6908265, 'italic': 1},
        'default': {},
        'eol': {},
        'groupref': {'fore': 2237106, 'italic': 1},
        'grouptag': {'fore': 7872391, 'size': 8},
        'match_highlight': {'back': 10092543},
        'operator': {'fore': 7872391, 'size': 12},
        'quantifier': {'bold': 1, 'fore': 16711680, 'size': 12},
        'special': {'bold': 1, 'fore': 16711680},
        'text': {}},
        'Ruby': {'class variables': {'fore': 26112},
        'data sections': {'fore': 6710886},
        'here documents': {'fore': 3368601},
        'instance variables': {'fore': 26112},
        'modules': {'fore': 153},
        'symbols': {'fore': 26214}},
        'Rx': {'breakpoints': {'back': 14540253},
        'children': {'back': 14540236},
        'default': {'bold': 1},
        'parents': {'back': 13434828}},
        'SQL': {'comments': {'fore': 3355443},
        'identifiers': {'fore': 26112},
        'keywords': {'bold': False}},
        'Text': {'bracehighlight': {'back': 3355443},
        'compound_document_defaults': {'back': 3355443},
        'control characters': {'back': 3355443},
        'indent guides': {'back': 3355443},
        'linenumbers': {'back': 16777215}},
        'XML': {'attribute name': {'fore': 26112},
        'attribute value': {'fore': 153},
        'cdata': {'fore': 9109504},
        'cdata content': {'fore': 3368601},
        'cdata tags': {'fore': 6710835},
        'comments': {'italic': False},
        'data': {'fore': 3368601},
        'declarations': {'fore': 16724787},
        'entity references': {'fore': 2302862},
        'pi content': {'fore': 9145088},
        'pi tags': {'fore': 9109504},
        'prolog': {'fore': 0},
        'tags': {'fore': 10027008},
        'xpath attributes': {'fore': 9109504},
        'xpath content': {'fore': 36095},
        'xpath tags': {'fore': 11}}

    'MiscLanguageSettings': { 'Text': {'globalSubLanguageBackgroundEnabled': False} },

    'Colors': {'activeBreakpointColor': 526573,
        'bookmarkColor': 14342664,
        'callingLineColor': 13382604,
        'caretFore': 16777215,
        'caretLineBack': 4016201,
        'currentLineColor': 16764108,
        'edgeColor': 2238503,
        'foldMarginColor': 14408667,
        'pendingBreakpointColor': 569096,
        'selBack': 4016201,
        'selFore': 16777215,
        'whitespaceColor': 2172967

    'Indicators': {
        'find_highlighting': {
            'alpha': 40,
            'color': 1279,
            'draw_underneath': True,
            'style': 7
        'linter_error': {
            'alpha': 100,
            'color': 255,
            'draw_underneath': True,
            'style': 1
        'linter_warning': {
            'alpha': 100,
            'color': 32768,
            'draw_underneath': True,
            'style': 1
        'soft_characters': {
            'alpha': 100,
            'color': 13209,
            'draw_underneath': False,
            'style': 6
        'tabstop_current': {
            'alpha': 100,
            'color': 3355647,
            'draw_underneath': True,
            'style': 7
        'tabstop_pending': {
            'alpha': 100,
            'color': 16751001,
            'draw_underneath': True,
            'style': 6
        'tag_matching': {
            'alpha': 100,
            'color': 33023,
            'draw_underneath': True,
            'style': 7

exports = parseScheme()

OK, so I decided to try downloading your Espresso scheme, and it actually has the same issue, for some reason the KSF files with functions and the exports variable do not work in my Komodo-Edit??? I’m on version 8.5

I just noticed the Espresso theme page says it’s for Komodo 9, but that’s not even out yet, do these types of Schemes not work on pre-9 versions?

Never mind, I got it figured out.

I wrote “for Komodo 9” because I didn’t test it in Komodo 8 (and I won’t test it because Komodo 9 is very close to the release).
Also please do not set Version in the ksf to your custom value. Not sure that Komodo doesn’t use this value.
And don’t forget about Python tabulation. It’s very important :wink:

OK, I thought that meant the version of the Scheme XD

Also, yeah, I realized there was 1 space that I missed that was breaking stuff. But the exports variable isn’t compatible with Komodo 8.5, at least in my testing, you can still define different variables and functions, but what happens is when Komodo 8.5 reads it the first time it parses it and converts the file to the default format (deletes all functions and replaces variables/function calls with the associated integer values).

Yep, my themes also compiled to the default format. It’s how works schemes in Komodo.

I have another quick question, I’ve noticed that changing the ‘default’ background color effects the debugger/command output panel, is there a way to independantly change it’s background color? I know the ‘Errors’ section changes the actual error lines, but that’s all I’ve been able to find in regards to the panel.

I’m not sure that you able to set different color for Command output tab. I think the command output window is a code editor window but without editing ability. (and probably with Txt syntax type).

What Defman said. It’s possible to change them independently but that’d take quite a bit of work.