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, ..)) ->