Merge pull request #15 from craftyjon/json-themes

Add support for new JSON format
This commit is contained in:
Thomas Pointhuber 2020-02-25 14:01:06 +01:00 committed by GitHub
commit dbf09d4c10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 692 additions and 0 deletions

View file

@ -23,6 +23,20 @@ The script expects the directory containing the colour scheme and the kicad conf
Example: Example:
`python3 patch.py ~/kicad-color-schemes/blue-green-dark/ ~/.config/kicad/` `python3 patch.py ~/kicad-color-schemes/blue-green-dark/ ~/.config/kicad/`
## JSON themes (for KiCad 6, and "5.99" nightly builds after February 2020)
KiCad 6 is changing to a JSON-based colour theme system. Recent nightly builds already support the
new system, where each colour theme lives in a JSON file in the `colors` directory of the user
settings path (see "How to use a colour theme" above.)
To use the JSON version of a theme, just copy the file into your `colors` directory. The next time
you run KiCad, it will detect the new theme file and you will be able to choose it in the
preferences. Each KiCad application can use a different color theme if you wish.
In the new system, the footprint editor and PcbNew use the same color theme. If you would like to
have different colours for those two applications, the way to do it is to choose a different theme
file in the PcbNew and footprint editor preferences dialogs.
## eeschema ## eeschema
color-scheme | screenshot color-scheme | screenshot

View file

@ -0,0 +1,171 @@
{
"board": {
"anchor": "rgb(0, 0, 132)",
"aux_items": "rgb(255, 255, 255)",
"b_adhes": "rgb(0, 0, 132)",
"b_crtyd": "rgb(149, 219, 223)",
"b_fab": "rgb(141, 210, 114)",
"b_mask": "rgba(54, 132, 109, 0.698)",
"b_paste": "rgb(0, 194, 194)",
"b_silks": "rgb(121, 101, 150)",
"background": "rgb(35, 41, 50)",
"cmts_user": "rgb(65, 160, 66)",
"copper": {
"b": "rgba(101, 162, 229, 0.800)",
"f": "rgba(194, 96, 101, 0.800)",
"in1": "rgba(194, 107, 170, 0.600)",
"in10": "rgb(132, 0, 132)",
"in11": "rgb(132, 0, 0)",
"in12": "rgb(132, 132, 0)",
"in13": "rgb(194, 194, 194)",
"in14": "rgb(0, 0, 132)",
"in15": "rgb(0, 132, 0)",
"in16": "rgb(132, 0, 0)",
"in17": "rgb(194, 194, 0)",
"in18": "rgb(194, 0, 194)",
"in19": "rgb(194, 0, 0)",
"in2": "rgba(127, 194, 161, 0.600)",
"in20": "rgb(0, 132, 132)",
"in21": "rgb(0, 132, 0)",
"in22": "rgb(0, 0, 132)",
"in23": "rgb(132, 132, 132)",
"in24": "rgb(132, 0, 132)",
"in25": "rgb(194, 194, 194)",
"in26": "rgb(132, 0, 132)",
"in27": "rgb(132, 0, 0)",
"in28": "rgb(132, 132, 0)",
"in29": "rgb(194, 194, 194)",
"in3": "rgb(194, 0, 0)",
"in30": "rgb(0, 0, 132)",
"in4": "rgb(0, 132, 132)",
"in5": "rgb(0, 132, 0)",
"in6": "rgb(0, 0, 132)",
"in7": "rgb(132, 132, 132)",
"in8": "rgb(132, 0, 132)",
"in9": "rgb(194, 194, 194)"
},
"cursor": "rgb(255, 255, 255)",
"dwgs_user": "rgb(165, 165, 165)",
"eco1_user": "rgb(0, 132, 0)",
"eco2_user": "rgb(255, 87, 98)",
"edge_cuts": "rgb(200, 163, 57)",
"f_adhes": "rgb(132, 0, 132)",
"f_crtyd": "rgb(201, 169, 249)",
"f_fab": "rgb(240, 216, 121)",
"f_mask": "rgba(180, 74, 76, 0.698)",
"f_paste": "rgb(255, 0, 255)",
"f_silks": "rgb(129, 190, 190)",
"footprint_text_back": "rgb(0, 0, 132)",
"footprint_text_front": "rgb(194, 194, 194)",
"footprint_text_invisible": "rgb(132, 132, 132)",
"grid": "rgb(97, 97, 97)",
"no_connect": "rgb(0, 0, 132)",
"pad_back": "rgba(82, 127, 185, 0.698)",
"pad_front": "rgba(194, 118, 97, 0.698)",
"plated_hole": "rgb(194, 194, 0)",
"ratsnest": "rgb(179, 179, 179)",
"via_blind_buried": "rgb(132, 132, 0)",
"via_micro": "rgb(0, 132, 132)",
"via_through": "rgb(194, 194, 194)",
"worksheet": "rgb(72, 0, 0)"
},
"fpedit": {
"anchor": "rgb(0, 0, 132)",
"aux_items": "rgb(255, 255, 255)",
"b_adhes": "rgb(0, 0, 132)",
"b_crtyd": "rgb(149, 219, 223)",
"b_fab": "rgb(141, 210, 114)",
"b_mask": "rgba(0, 245, 223, 0.600)",
"b_paste": "rgb(0, 194, 194)",
"b_silks": "rgb(121, 101, 150)",
"background": "rgb(0, 0, 0)",
"cmts_user": "rgb(0, 0, 132)",
"copper": {
"b": "rgba(82, 127, 185, 0.800)",
"f": "rgba(236, 144, 118, 0.800)",
"in1": "rgb(194, 194, 0)",
"in10": "rgb(132, 0, 132)",
"in11": "rgb(132, 0, 0)",
"in12": "rgb(132, 132, 0)",
"in13": "rgb(194, 194, 194)",
"in14": "rgb(0, 0, 132)",
"in15": "rgb(0, 132, 0)",
"in16": "rgb(132, 0, 0)",
"in17": "rgb(194, 194, 0)",
"in18": "rgb(194, 0, 194)",
"in19": "rgb(194, 0, 0)",
"in2": "rgb(194, 0, 194)",
"in20": "rgb(0, 132, 132)",
"in21": "rgb(0, 132, 0)",
"in22": "rgb(0, 0, 132)",
"in23": "rgb(132, 132, 132)",
"in24": "rgb(132, 0, 132)",
"in25": "rgb(194, 194, 194)",
"in26": "rgb(132, 0, 132)",
"in27": "rgb(132, 0, 0)",
"in28": "rgb(132, 132, 0)",
"in29": "rgb(194, 194, 194)",
"in3": "rgb(194, 0, 0)",
"in30": "rgb(0, 0, 132)",
"in4": "rgb(0, 132, 132)",
"in5": "rgb(0, 132, 0)",
"in6": "rgb(0, 0, 132)",
"in7": "rgb(132, 132, 132)",
"in8": "rgb(132, 0, 132)",
"in9": "rgb(194, 194, 194)"
},
"cursor": "rgb(255, 255, 255)",
"dwgs_user": "rgb(194, 194, 194)",
"eco1_user": "rgb(0, 132, 0)",
"eco2_user": "rgb(194, 194, 0)",
"edge_cuts": "rgb(194, 194, 0)",
"f_adhes": "rgb(132, 0, 132)",
"f_crtyd": "rgb(201, 164, 249)",
"f_fab": "rgb(240, 216, 121)",
"f_mask": "rgba(180, 74, 76, 0.600)",
"f_paste": "rgba(211, 67, 187, 0.600)",
"f_silks": "rgb(102, 150, 150)",
"footprint_text_back": "rgb(0, 0, 132)",
"footprint_text_front": "rgb(194, 194, 194)",
"footprint_text_invisible": "rgb(132, 132, 132)",
"grid": "rgba(88, 98, 113, 0.718)",
"pad_back": "rgba(82, 127, 185, 0.698)",
"pad_front": "rgba(194, 118, 97, 0.698)",
"pad_through_hole": "rgba(200, 200, 121, 0.698)",
"plated_hole": "rgb(194, 194, 0)",
"worksheet": "rgb(72, 0, 0)"
},
"meta": {
"filename": "behave-dark",
"name": "Behave Dark",
"version": 0
},
"schematic": {
"background": "rgb(35, 41, 50)",
"brightened": "rgb(201, 169, 249)",
"bus": "rgb(68, 135, 170)",
"component_body": "rgb(81, 60, 86)",
"component_outline": "rgb(196, 98, 107)",
"erc_error": "rgb(200, 68, 85)",
"erc_warning": "rgb(226, 163, 52)",
"fields": "rgb(120, 101, 150)",
"grid": "rgb(132, 132, 132)",
"junction": "rgb(141, 210, 114)",
"label_global": "rgb(196, 108, 45)",
"label_hier": "rgb(195, 174, 114)",
"label_local": "rgb(68, 135, 170)",
"net_name": "rgb(202, 202, 202)",
"no_connect": "rgb(149, 219, 223)",
"note": "rgb(68, 135, 170)",
"pin": "rgb(196, 98, 107)",
"pin_name": "rgb(102, 150, 150)",
"pin_number": "rgb(196, 98, 107)",
"reference": "rgb(166, 131, 225)",
"sheet": "rgb(133, 111, 165)",
"sheet_filename": "rgb(133, 111, 165)",
"sheet_label": "rgb(196, 122, 79)",
"sheet_name": "rgb(102, 150, 150)",
"value": "rgb(102, 150, 150)",
"wire": "rgb(141, 210, 114)"
}
}

View file

@ -0,0 +1,144 @@
{
"board": {
"anchor": "rgb(0, 0, 132)",
"aux_items": "rgb(255, 255, 255)",
"b_adhes": "rgb(0, 0, 132)",
"b_crtyd": "rgb(179, 190, 56)",
"b_fab": "rgb(156, 200, 67)",
"b_mask": "rgba(0, 100, 0, 0.600)",
"b_paste": "rgba(132, 88, 44, 0.600)",
"b_silks": "rgb(150, 138, 103)",
"background": "rgb(50, 50, 50)",
"cmts_user": "rgb(132, 51, 52)",
"copper": {
"b": "rgba(44, 150, 62, 0.702)",
"f": "rgba(44, 44, 150, 0.702)",
"in1": "rgba(110, 50, 170, 0.702)",
"in10": "rgb(132, 0, 132)",
"in11": "rgb(132, 0, 0)",
"in12": "rgb(132, 132, 0)",
"in13": "rgb(194, 194, 194)",
"in14": "rgb(0, 0, 132)",
"in15": "rgb(0, 132, 0)",
"in16": "rgb(132, 0, 0)",
"in17": "rgb(194, 194, 0)",
"in18": "rgb(194, 0, 194)",
"in19": "rgb(194, 0, 0)",
"in2": "rgba(200, 129, 59, 0.702)",
"in20": "rgb(0, 132, 132)",
"in21": "rgb(0, 132, 0)",
"in22": "rgb(0, 0, 132)",
"in23": "rgb(132, 132, 132)",
"in24": "rgb(132, 0, 132)",
"in25": "rgb(194, 194, 194)",
"in26": "rgb(132, 0, 132)",
"in27": "rgb(132, 0, 0)",
"in28": "rgb(132, 132, 0)",
"in29": "rgb(194, 194, 194)",
"in3": "rgb(194, 0, 0)",
"in30": "rgb(0, 0, 132)",
"in4": "rgb(0, 132, 132)",
"in5": "rgb(0, 132, 0)",
"in6": "rgb(0, 0, 132)",
"in7": "rgb(132, 132, 132)",
"in8": "rgb(132, 0, 132)",
"in9": "rgb(194, 194, 194)"
},
"cursor": "rgb(255, 255, 255)",
"dwgs_user": "rgb(210, 210, 210)",
"eco1_user": "rgb(0, 132, 0)",
"eco2_user": "rgb(194, 194, 0)",
"edge_cuts": "rgb(194, 194, 0)",
"f_adhes": "rgb(132, 0, 132)",
"f_crtyd": "rgb(91, 220, 220)",
"f_fab": "rgb(59, 153, 200)",
"f_mask": "rgba(29, 29, 100, 0.600)",
"f_paste": "rgba(132, 70, 74, 0.400)",
"f_silks": "rgb(103, 150, 142)",
"footprint_text_back": "rgb(0, 0, 132)",
"footprint_text_front": "rgb(194, 194, 194)",
"footprint_text_invisible": "rgb(132, 132, 132)",
"grid": "rgb(132, 132, 132)",
"no_connect": "rgb(0, 0, 132)",
"pad_back": "rgba(53, 180, 74, 0.851)",
"pad_front": "rgba(53, 53, 180, 0.851)",
"pad_through_hole": "rgba(194, 184, 84, 0.702)",
"plated_hole": "rgb(160, 153, 0)",
"ratsnest": "rgb(255, 255, 255)",
"via_blind_buried": "rgb(132, 132, 0)",
"via_micro": "rgb(0, 132, 132)",
"via_through": "rgba(160, 160, 160, 0.800)",
"worksheet": "rgb(119, 118, 121)"
},
"fpedit": {
"anchor": "rgb(0, 0, 132)",
"aux_items": "rgb(255, 255, 255)",
"b_adhes": "rgb(0, 0, 132)",
"b_crtyd": "rgb(179, 190, 56)",
"b_fab": "rgb(156, 200, 67)",
"b_mask": "rgba(0, 100, 0, 0.600)",
"b_paste": "rgba(132, 88, 44, 0.600)",
"b_silks": "rgb(150, 138, 103)",
"background": "rgb(50, 50, 50)",
"cmts_user": "rgb(132, 51, 52)",
"copper": {
"b": "rgba(44, 150, 62, 0.702)",
"f": "rgba(44, 44, 150, 0.702)",
"in1": "rgba(110, 50, 170, 0.702)",
"in10": "rgb(132, 0, 132)",
"in11": "rgb(132, 0, 0)",
"in12": "rgb(132, 132, 0)",
"in13": "rgb(194, 194, 194)",
"in14": "rgb(0, 0, 132)",
"in15": "rgb(0, 132, 0)",
"in16": "rgb(132, 0, 0)",
"in17": "rgb(194, 194, 0)",
"in18": "rgb(194, 0, 194)",
"in19": "rgb(194, 0, 0)",
"in2": "rgba(200, 129, 59, 0.702)",
"in20": "rgb(0, 132, 132)",
"in21": "rgb(0, 132, 0)",
"in22": "rgb(0, 0, 132)",
"in23": "rgb(132, 132, 132)",
"in24": "rgb(132, 0, 132)",
"in25": "rgb(194, 194, 194)",
"in26": "rgb(132, 0, 132)",
"in27": "rgb(132, 0, 0)",
"in28": "rgb(132, 132, 0)",
"in29": "rgb(194, 194, 194)",
"in3": "rgb(194, 0, 0)",
"in30": "rgb(0, 0, 132)",
"in4": "rgb(0, 132, 132)",
"in5": "rgb(0, 132, 0)",
"in6": "rgb(0, 0, 132)",
"in7": "rgb(132, 132, 132)",
"in8": "rgb(132, 0, 132)",
"in9": "rgb(194, 194, 194)"
},
"cursor": "rgb(255, 255, 255)",
"dwgs_user": "rgb(210, 210, 210)",
"eco1_user": "rgb(0, 132, 0)",
"eco2_user": "rgb(194, 194, 0)",
"edge_cuts": "rgb(194, 194, 0)",
"f_adhes": "rgb(132, 0, 132)",
"f_crtyd": "rgb(91, 220, 220)",
"f_fab": "rgb(59, 153, 200)",
"f_mask": "rgba(29, 29, 100, 0.600)",
"f_paste": "rgba(132, 70, 74, 0.400)",
"f_silks": "rgb(103, 150, 142)",
"footprint_text_back": "rgb(0, 0, 132)",
"footprint_text_front": "rgb(194, 194, 194)",
"footprint_text_invisible": "rgb(132, 132, 132)",
"grid": "rgb(132, 132, 132)",
"pad_back": "rgba(53, 180, 74, 0.851)",
"pad_front": "rgba(53, 53, 180, 0.502)",
"pad_through_hole": "rgba(194, 184, 84, 0.702)",
"plated_hole": "rgb(160, 153, 0)",
"worksheet": "rgb(119, 118, 121)"
},
"meta": {
"filename": "blue-green-dark",
"name": "Blue-Green Dark",
"version": 0
}
}

38
blue-tone/blue-tone.json Normal file
View file

@ -0,0 +1,38 @@
{
"meta": {
"filename": "blue-tone",
"name": "Blue Tone",
"version": 0
},
"schematic": {
"background": "rgb(255, 255, 255)",
"brightened": "rgb(255, 0, 255)",
"bus": "rgb(110, 59, 160)",
"component_body": "rgb(210, 212, 255)",
"component_outline": "rgb(49, 49, 132)",
"cursor": "rgb(0, 0, 0)",
"erc_error": "rgb(180, 53, 53)",
"erc_warning": "rgb(255, 139, 0)",
"fields": "rgb(0, 103, 132)",
"grid": "rgb(0, 0, 0)",
"hidden": "rgb(194, 194, 194)",
"junction": "rgb(66, 132, 55)",
"label_global": "rgb(132, 39, 132)",
"label_hier": "rgb(84, 38, 130)",
"label_local": "rgb(0, 0, 0)",
"net_name": "rgb(132, 132, 132)",
"no_connect": "rgb(93, 0, 132)",
"note": "rgb(0, 0, 194)",
"pin": "rgb(61, 51, 132)",
"pin_name": "rgb(65, 29, 100)",
"pin_number": "rgb(90, 78, 202)",
"reference": "rgb(58, 115, 132)",
"sheet": "rgb(82, 61, 101)",
"sheet_filename": "rgb(0, 132, 132)",
"sheet_label": "rgb(85, 39, 132)",
"sheet_name": "rgb(0, 132, 132)",
"value": "rgb(58, 116, 132)",
"wire": "rgb(66, 132, 55)",
"worksheet": "rgb(0, 0, 27)"
}
}

255
migrate_to_v6.py Executable file
View file

@ -0,0 +1,255 @@
#!/usr/bin/env python3
import argparse
import json
from pathlib import Path
import re
KEY_MAP = {
"Color4DBgCanvasEx": "schematic.background",
"Color4DBodyBgEx": "schematic.component_body",
"Color4DBodyEx": "schematic.component_outline",
"Color4DBrightenedEx": "schematic.brightened",
"Color4DBrighenedEx": "schematic.brightened",
"Color4DBusEx": "schematic.bus",
"Color4DConnEx": "schematic.junction",
"Color4DCursorEx": "schematic.cursor",
"Color4DErcEEx": "schematic.erc_error",
"Color4DErcWEx": "schematic.erc_warning",
"Color4DFieldEx": "schematic.fields",
"Color4DGLabelEx": "schematic.label_global",
"Color4DGridEx": "schematic.grid",
"Color4DHLabelEx": "schematic.label_hier",
"Color4DHiddenEx": "schematic.hidden",
"Color4DLLabelEx": "schematic.label_local",
"Color4DNetNameEx": "schematic.net_name",
"Color4DNoConnectEx": "schematic.no_connect",
"Color4DNoteEx": "schematic.note",
"Color4DPinEx": "schematic.pin",
"Color4DPinNameEx": "schematic.pin_name",
"Color4DPinNumEx": "schematic.pin_number",
"Color4DReferenceEx": "schematic.reference",
"Color4DShadowEx": "schematic.shadow",
"Color4DSheetEx": "schematic.sheet",
"Color4DSheetFileNameEx": "schematic.sheet_filename",
"Color4DSheetLabelEx": "schematic.sheet_label",
"Color4DSheetNameEx": "schematic.sheet_name",
"Color4DValueEx": "schematic.value",
"Color4DWireEx": "schematic.wire",
"Color4DWorksheetEx": "schematic.worksheet",
"Color4DAnchorEx": "board.anchor",
"Color4DAuxItems": "board.aux_items",
"Color4DPCBBackground": "board.background",
"Color4DPCBCursor": "board.cursor",
"Color4DTxtBackEx": "board.footprint_text_back",
"Color4DTxtFrontEx": "board.footprint_text_front",
"Color4DTxtInvisEx": "board.footprint_text_invisible",
"Color4DGrid": "board.grid",
"Color4DNoNetPadMarker": "board.no_connect",
"Color4DPadBackEx": "board.pad_back",
"Color4DPadFrontEx": "board.pad_front",
"Color4DNonPlatedEx": "board.plated_hole",
"Color4DPadThruHoleEx": "board.pad_through_hole",
"Color4DRatsEx": "board.ratsnest",
"Color4DViaBBlindEx": "board.via_blind_buried",
"Color4DViaMicroEx": "board.via_micro",
"Color4DViaThruEx": "board.via_through",
"Color4DWorksheet": "board.worksheet",
"Color4DPCBLayer_F.Cu": "board.copper.f",
"Color4DPCBLayer_In1.Cu": "board.copper.in1",
"Color4DPCBLayer_In2.Cu": "board.copper.in2",
"Color4DPCBLayer_In3.Cu": "board.copper.in3",
"Color4DPCBLayer_In4.Cu": "board.copper.in4",
"Color4DPCBLayer_In5.Cu": "board.copper.in5",
"Color4DPCBLayer_In6.Cu": "board.copper.in6",
"Color4DPCBLayer_In7.Cu": "board.copper.in7",
"Color4DPCBLayer_In8.Cu": "board.copper.in8",
"Color4DPCBLayer_In9.Cu": "board.copper.in9",
"Color4DPCBLayer_In10.Cu": "board.copper.in10",
"Color4DPCBLayer_In11.Cu": "board.copper.in11",
"Color4DPCBLayer_In12.Cu": "board.copper.in12",
"Color4DPCBLayer_In13.Cu": "board.copper.in13",
"Color4DPCBLayer_In14.Cu": "board.copper.in14",
"Color4DPCBLayer_In15.Cu": "board.copper.in15",
"Color4DPCBLayer_In16.Cu": "board.copper.in16",
"Color4DPCBLayer_In17.Cu": "board.copper.in17",
"Color4DPCBLayer_In18.Cu": "board.copper.in18",
"Color4DPCBLayer_In19.Cu": "board.copper.in19",
"Color4DPCBLayer_In20.Cu": "board.copper.in20",
"Color4DPCBLayer_In21.Cu": "board.copper.in21",
"Color4DPCBLayer_In22.Cu": "board.copper.in22",
"Color4DPCBLayer_In23.Cu": "board.copper.in23",
"Color4DPCBLayer_In24.Cu": "board.copper.in24",
"Color4DPCBLayer_In25.Cu": "board.copper.in25",
"Color4DPCBLayer_In26.Cu": "board.copper.in26",
"Color4DPCBLayer_In27.Cu": "board.copper.in27",
"Color4DPCBLayer_In28.Cu": "board.copper.in28",
"Color4DPCBLayer_In29.Cu": "board.copper.in29",
"Color4DPCBLayer_In30.Cu": "board.copper.in30",
"Color4DPCBLayer_B.Cu": "board.copper.b",
"Color4DPCBLayer_B.Adhes": "board.b_adhes",
"Color4DPCBLayer_F.Adhes": "board.f_adhes",
"Color4DPCBLayer_B.Paste": "board.b_paste",
"Color4DPCBLayer_F.Paste": "board.f_paste",
"Color4DPCBLayer_B.SilkS": "board.b_silks",
"Color4DPCBLayer_F.SilkS": "board.f_silks",
"Color4DPCBLayer_B.Mask": "board.b_mask",
"Color4DPCBLayer_F.Mask": "board.f_mask",
"Color4DPCBLayer_Dwgs.User": "board.dwgs_user",
"Color4DPCBLayer_Cmts.User": "board.cmts_user",
"Color4DPCBLayer_Eco1.User": "board.eco1_user",
"Color4DPCBLayer_Eco2.User": "board.eco2_user",
"Color4DPCBLayer_Edge.Cuts": "board.edge_cuts",
"Color4DPCBLayer_Margin=rgb": "board.margin",
"Color4DPCBLayer_B.CrtYd": "board.b_crtyd",
"Color4DPCBLayer_F.CrtYd": "board.f_crtyd",
"Color4DPCBLayer_B.Fab": "board.b_fab",
"Color4DPCBLayer_F.Fab": "board.f_fab",
"ModEditColor4DAnchorEx": "fpedit.anchor",
"ModEditColor4DAuxItems": "fpedit.aux_items",
"ModEditColor4DPCBBackground": "fpedit.background",
"ModEditColor4DPCBCursor": "fpedit.cursor",
"ModEditColor4DTxtBackEx": "fpedit.footprint_text_back",
"ModEditColor4DTxtFrontEx": "fpedit.footprint_text_front",
"ModEditColor4DTxtInvisEx": "fpedit.footprint_text_invisible",
"ModEditColor4DGrid": "fpedit.grid",
"ModEditColor4DPadBackEx": "fpedit.pad_back",
"ModEditColor4DPadFrontEx": "fpedit.pad_front",
"ModEditColor4DNonPlatedEx": "fpedit.plated_hole",
"ModEditColor4DPadThruHoleEx": "fpedit.pad_through_hole",
"ModEditColor4DWorksheet": "fpedit.worksheet",
"ModEditColor4DPCBLayer_F.Cu": "fpedit.copper.f",
"ModEditColor4DPCBLayer_In1.Cu": "fpedit.copper.in1",
"ModEditColor4DPCBLayer_In2.Cu": "fpedit.copper.in2",
"ModEditColor4DPCBLayer_In3.Cu": "fpedit.copper.in3",
"ModEditColor4DPCBLayer_In4.Cu": "fpedit.copper.in4",
"ModEditColor4DPCBLayer_In5.Cu": "fpedit.copper.in5",
"ModEditColor4DPCBLayer_In6.Cu": "fpedit.copper.in6",
"ModEditColor4DPCBLayer_In7.Cu": "fpedit.copper.in7",
"ModEditColor4DPCBLayer_In8.Cu": "fpedit.copper.in8",
"ModEditColor4DPCBLayer_In9.Cu": "fpedit.copper.in9",
"ModEditColor4DPCBLayer_In10.Cu": "fpedit.copper.in10",
"ModEditColor4DPCBLayer_In11.Cu": "fpedit.copper.in11",
"ModEditColor4DPCBLayer_In12.Cu": "fpedit.copper.in12",
"ModEditColor4DPCBLayer_In13.Cu": "fpedit.copper.in13",
"ModEditColor4DPCBLayer_In14.Cu": "fpedit.copper.in14",
"ModEditColor4DPCBLayer_In15.Cu": "fpedit.copper.in15",
"ModEditColor4DPCBLayer_In16.Cu": "fpedit.copper.in16",
"ModEditColor4DPCBLayer_In17.Cu": "fpedit.copper.in17",
"ModEditColor4DPCBLayer_In18.Cu": "fpedit.copper.in18",
"ModEditColor4DPCBLayer_In19.Cu": "fpedit.copper.in19",
"ModEditColor4DPCBLayer_In20.Cu": "fpedit.copper.in20",
"ModEditColor4DPCBLayer_In21.Cu": "fpedit.copper.in21",
"ModEditColor4DPCBLayer_In22.Cu": "fpedit.copper.in22",
"ModEditColor4DPCBLayer_In23.Cu": "fpedit.copper.in23",
"ModEditColor4DPCBLayer_In24.Cu": "fpedit.copper.in24",
"ModEditColor4DPCBLayer_In25.Cu": "fpedit.copper.in25",
"ModEditColor4DPCBLayer_In26.Cu": "fpedit.copper.in26",
"ModEditColor4DPCBLayer_In27.Cu": "fpedit.copper.in27",
"ModEditColor4DPCBLayer_In28.Cu": "fpedit.copper.in28",
"ModEditColor4DPCBLayer_In29.Cu": "fpedit.copper.in29",
"ModEditColor4DPCBLayer_In30.Cu": "fpedit.copper.in30",
"ModEditColor4DPCBLayer_B.Cu": "fpedit.copper.b",
"ModEditColor4DPCBLayer_B.Adhes": "fpedit.b_adhes",
"ModEditColor4DPCBLayer_F.Adhes": "fpedit.f_adhes",
"ModEditColor4DPCBLayer_B.Paste": "fpedit.b_paste",
"ModEditColor4DPCBLayer_F.Paste": "fpedit.f_paste",
"ModEditColor4DPCBLayer_B.SilkS": "fpedit.b_silks",
"ModEditColor4DPCBLayer_F.SilkS": "fpedit.f_silks",
"ModEditColor4DPCBLayer_B.Mask": "fpedit.b_mask",
"ModEditColor4DPCBLayer_F.Mask": "fpedit.f_mask",
"ModEditColor4DPCBLayer_Dwgs.User": "fpedit.dwgs_user",
"ModEditColor4DPCBLayer_Cmts.User": "fpedit.cmts_user",
"ModEditColor4DPCBLayer_Eco1.User": "fpedit.eco1_user",
"ModEditColor4DPCBLayer_Eco2.User": "fpedit.eco2_user",
"ModEditColor4DPCBLayer_Edge.Cuts": "fpedit.edge_cuts",
"ModEditColor4DPCBLayer_Margin=rgb": "fpedit.margin",
"ModEditColor4DPCBLayer_B.CrtYd": "fpedit.b_crtyd",
"ModEditColor4DPCBLayer_F.CrtYd": "fpedit.f_crtyd",
"ModEditColor4DPCBLayer_B.Fab": "fpedit.b_fab",
"ModEditColor4DPCBLayer_F.Fab": "fpedit.f_fab",
}
def recursive_insert(dictionary, keys, value):
if len(keys) > 1:
key = keys.pop(0)
if key in dictionary:
nested = dictionary[key]
else:
nested = dict()
dictionary[key] = recursive_insert(nested, keys, value)
return dictionary
else:
dictionary[keys[0]] = value
return dictionary
def main():
parser = argparse.ArgumentParser(description='Migrate a scheme to V6 JSON format')
parser.add_argument('scheme_path', type=Path, nargs=1, help='Path to scheme definition')
parser.add_argument('name', type=str, nargs=1, help='Display name of the output theme')
args = parser.parse_args()
if not args.scheme_path[0].is_dir():
print("'{}' needs to be the directory of a scheme".format(args.scheme_path[0]))
filename = args.scheme_path[0].stem
json_data = {
"meta": {
"filename": filename,
"version": 0,
"name": args.name[0]
}
}
for file in ['eeschema', 'pcbnew', 'footprint_editor']:
fp = args.scheme_path[0] / file
if not fp.is_file():
continue
print("Migrating {}".format(fp.name))
data = {}
with open(fp, 'r') as f:
for line in f:
l = line.strip()
if l == '':
continue
try:
key, color = l.split('=')
except:
continue
if color is not None:
try:
json_key = KEY_MAP[key]
except:
print("Warning: unknown key {}".format(key))
continue
keys = json_key.split('.')
if file == 'footprint_editor':
keys[0] = 'fpedit'
recursive_insert(data, keys, color)
json_data.update(data)
new_file_path = args.scheme_path[0] / (filename + ".json")
with open(new_file_path, 'w') as f:
json.dump(json_data, f, sort_keys=True, indent=2)
if __name__ == '__main__':
main()

View file

@ -0,0 +1,35 @@
{
"meta": {
"filename": "solarized-dark",
"name": "Solarized Dark",
"version": 0
},
"schematic": {
"background": "rgb(0, 43, 54)",
"brightened": "rgb(211, 54, 130)",
"bus": "rgb(38, 139, 210)",
"component_body": "rgb(7, 54, 66)",
"component_outline": "rgb(147, 161, 161)",
"erc_error": "rgb(220, 50, 47)",
"erc_warning": "rgb(220, 50, 47)",
"fields": "rgb(88, 110, 117)",
"grid": "rgb(147, 161, 161)",
"junction": "rgb(133, 153, 0)",
"label_global": "rgb(42, 161, 152)",
"label_hier": "rgb(42, 161, 152)",
"label_local": "rgb(42, 161, 152)",
"net_name": "rgb(0, 0, 0)",
"no_connect": "rgb(108, 113, 196)",
"note": "rgb(147, 161, 161)",
"pin": "rgb(147, 161, 161)",
"pin_name": "rgb(203, 75, 22)",
"pin_number": "rgb(181, 137, 0)",
"reference": "rgb(38, 139, 210)",
"sheet": "rgb(147, 161, 161)",
"sheet_filename": "rgb(38, 139, 210)",
"sheet_label": "rgb(203, 75, 22)",
"sheet_name": "rgb(108, 113, 196)",
"value": "rgb(108, 113, 196)",
"wire": "rgb(133, 153, 0)"
}
}

View file

@ -0,0 +1,35 @@
{
"meta": {
"filename": "solarized-light",
"name": "Solarized Light",
"version": 0
},
"schematic": {
"background": "rgb(253, 246, 227)",
"brightened": "rgb(211, 54, 130)",
"bus": "rgb(38, 139, 210)",
"component_body": "rgb(238, 232, 213)",
"component_outline": "rgb(88, 110, 117)",
"erc_error": "rgb(220, 50, 47)",
"erc_warning": "rgb(220, 50, 47)",
"fields": "rgb(147, 161, 161)",
"grid": "rgb(88, 110, 117)",
"junction": "rgb(133, 153, 0)",
"label_global": "rgb(42, 161, 152)",
"label_hier": "rgb(42, 161, 152)",
"label_local": "rgb(42, 161, 152)",
"net_name": "rgb(0, 0, 0)",
"no_connect": "rgb(108, 113, 196)",
"note": "rgb(88, 110, 117)",
"pin": "rgb(88, 110, 117)",
"pin_name": "rgb(203, 75, 22)",
"pin_number": "rgb(181, 137, 0)",
"reference": "rgb(38, 139, 210)",
"sheet": "rgb(88, 110, 117)",
"sheet_filename": "rgb(38, 139, 210)",
"sheet_label": "rgb(203, 75, 22)",
"sheet_name": "rgb(108, 113, 196)",
"value": "rgb(108, 113, 196)",
"wire": "rgb(133, 153, 0)"
}
}