diff --git a/src/kicad/common.ts b/src/kicad/common.ts index 89842a1..da4f2b8 100644 --- a/src/kicad/common.ts +++ b/src/kicad/common.ts @@ -263,6 +263,7 @@ export class Font { P.atom("bold"), P.atom("italic"), P.pair("line_spacing", T.number), + P.color(), ), ); diff --git a/src/viewers/schematic/painter.ts b/src/viewers/schematic/painter.ts index 47672a1..16732be 100644 --- a/src/viewers/schematic/painter.ts +++ b/src/viewers/schematic/painter.ts @@ -317,7 +317,14 @@ class TextPainter extends SchematicItemPainter { schtext.apply_at(t.at); schtext.apply_effects(t.effects); - schtext.attributes.color = this.dim_if_needed(this.theme.note); + const font_color = t.effects.font.color; + if (font_color.is_transparent_black) { + // The color was not specified. + const text_color = this.theme.note; + schtext.attributes.color = this.dim_if_needed(text_color); + } else { + schtext.attributes.color = this.dim_if_needed(font_color); + } this.gfx.state.push(); StrokeFont.default().draw( @@ -347,22 +354,28 @@ class PropertyPainter extends SchematicItemPainter { color = this.theme.sheet_fields; } - switch (p.name) { - case "Reference": - color = this.theme.reference; - break; - case "Value": - color = this.theme.value; - break; - case "Sheet name": - color = this.theme.sheet_name; - break; - case "Sheet file": - color = this.theme.sheet_filename; - break; - } + const font_color = p.effects.font.color; + if (font_color.is_transparent_black) { + // The color was not specified. + switch (p.name) { + case "Reference": + color = this.theme.reference; + break; + case "Value": + color = this.theme.value; + break; + case "Sheet name": + color = this.theme.sheet_name; + break; + case "Sheet file": + color = this.theme.sheet_filename; + break; + } - color = this.dim_if_needed(color); + color = this.dim_if_needed(color); + } else { + color = this.dim_if_needed(font_color); + } const parent = p.parent as schematic_items.SchematicSymbol; const transform = this.view_painter.current_symbol_transform;