From f832b2e9f58c1beb2e661a03b8582d123eb3012e Mon Sep 17 00:00:00 2001 From: Benoit Lemoine Date: Mon, 30 Mar 2020 19:39:49 -0400 Subject: [PATCH] fix(svg): stroke color grey when field is dark * works also for pean/ counter-ermine, etc. Closes #6 --- .../__snapshots__/CoatsOfArmsDisplay.spec.tsx.snap | 4 ++-- src/app/from-blason/blason.helpers.ts | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/from-blason/__snapshots__/CoatsOfArmsDisplay.spec.tsx.snap b/src/app/from-blason/__snapshots__/CoatsOfArmsDisplay.spec.tsx.snap index 967dec7..dad442e 100644 --- a/src/app/from-blason/__snapshots__/CoatsOfArmsDisplay.spec.tsx.snap +++ b/src/app/from-blason/__snapshots__/CoatsOfArmsDisplay.spec.tsx.snap @@ -1366,7 +1366,7 @@ exports[`CoatsOfArms should render 'Azure, two crosses moline counter ermine' 1` onClick={[Function]} onMouseDown={[Function]} onMouseUp={[Function]} - stroke="#000" + stroke="#777" strokeWidth={1} style={ Object { @@ -1380,7 +1380,7 @@ exports[`CoatsOfArms should render 'Azure, two crosses moline counter ermine' 1` onClick={[Function]} onMouseDown={[Function]} onMouseUp={[Function]} - stroke="#000" + stroke="#777" strokeWidth={1} style={ Object { diff --git a/src/app/from-blason/blason.helpers.ts b/src/app/from-blason/blason.helpers.ts index f49a65c..5d189eb 100644 --- a/src/app/from-blason/blason.helpers.ts +++ b/src/app/from-blason/blason.helpers.ts @@ -1,5 +1,5 @@ import { Blason, SimpleBlason } from '../model/blason'; -import { areTinctureEquals, Furs, Tincture } from '../model/tincture'; +import { areTinctureEquals, Furs, isFur, Tincture } from '../model/tincture'; import { cannotHappen } from '../../utils/cannot-happen'; import { Charge } from '../model/charge'; import { Field } from '../model/field'; @@ -98,5 +98,8 @@ export function isThereFur(blason: Blason, fur: Furs): boolean { } export function getStrokeColor(tincture: Tincture): string { + if (isFur(tincture)) { + return getStrokeColor(tincture.field); + } return tincture.name === 'sable' ? '#777' : '#000'; }