From 71ffecc2d51cc364052f506e0c168928901ba5c3 Mon Sep 17 00:00:00 2001 From: Lily Rose Date: Mon, 28 Jul 2025 18:08:44 +1000 Subject: [PATCH] Fix style of NpThroughHole pad drills --- src/substrate.gleam | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/substrate.gleam b/src/substrate.gleam index 61fd1ab..fd577d2 100644 --- a/src/substrate.gleam +++ b/src/substrate.gleam @@ -2,6 +2,7 @@ import gleam/float import gleam/list import gleam/option.{None, Some} import gleam/order +import gleam/string import kicad_sexpr import kicad_sexpr/token.{type Footprint, type Pad} import lustre/attribute.{style} as _attribute @@ -189,8 +190,8 @@ fn create_svg(footprint: Footprint) -> String { transform:, children: footprint.pads |> list.filter(fn(pad) { - pad.layers |> list.contains(token.Layer("F.Cu")) - || pad.layers |> list.contains(token.Layer("*.Cu")) + pad.layers + |> list.any(fn(layer) { layer.layer |> string.ends_with(".Cu") }) }) |> list.map(pad_to_element), ), @@ -561,9 +562,11 @@ fn pad_to_element(pad: Pad) -> Element(a) { ) } } - let fill = Some(bg_col) - let stroke = Some("#E7B629") - let stroke_width = Some(0.03333) + let #(fill, stroke, stroke_width) = case pad.type_ { + token.ThroughHolePadType -> #(Some(bg_col), Some("#E7B629"), Some(0.03333)) + token.NpThroughHolePadType -> #(Some("#18C7D6"), None, None) + _ -> #(None, None, None) + } case pad.drill { Some(token.PadDrillDefinition(False, Some(d), ..)) | Some(token.PadDrillDefinition(True, Some(d), None, ..)) ->