Skip to content

Commit a7ae3ea

Browse files
committed
v1.7.5: Add board context
1 parent 7061619 commit a7ae3ea

File tree

5 files changed

+54
-29
lines changed

5 files changed

+54
-29
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.7.5] - 2026-02-27
9+
10+
### Added
11+
12+
- Added the `board` colour context and picker. It defaults to the `background` colour when not present, and when both are the same, changing `background` also changes `board`, but `board` can be set independently.
13+
814
## [1.7.4] - 2026-02-11
915

1016
### Added

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "abstractplay-designer",
33
"private": true,
4-
"version": "1.7.4",
4+
"version": "1.7.5",
55
"type": "module",
66
"scripts": {
77
"dev": "set NODE_ENV=development && vite",
@@ -31,7 +31,7 @@
3131
"vite": "^4.4.5"
3232
},
3333
"dependencies": {
34-
"@abstractplay/renderer": "^1.0.0-ci-21915038092.0",
34+
"@abstractplay/renderer": "^1.0.0-ci-22496217164.0",
3535
"@types/html2canvas": "^0.5.35",
3636
"@zerodevx/svelte-toast": "^0.9.6",
3737
"gif.js.optimized": "^1.0.1",

src/components/Board.svelte

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,19 @@
1212
import ColorPicker from "svelte-awesome-color-picker";
1313
import { generateField as genField } from "#/lib/modular";
1414
15+
const handleBackgroundChange = (event: CustomEvent<{ hex: string }>) => {
16+
if (event.detail.hex === undefined) {
17+
return;
18+
}
19+
colourContext.update((v) => {
20+
const newContext = { ...v, background: event.detail.hex };
21+
if (v.background === v.board) {
22+
newContext.board = event.detail.hex;
23+
}
24+
return newContext;
25+
});
26+
};
27+
1528
const boardTypes = new Map<SupportedBoards, string>([
1629
[
1730
"squares",
@@ -443,6 +456,7 @@
443456
444457
let previewDiv: HTMLDivElement;
445458
onMount(() => {
459+
colourContext.update((v) => ({ ...v, board: v.board ?? v.background }));
446460
const updatePreview = (state: RenderRepModified) => {
447461
if (previewDiv !== undefined && previewDiv !== null) {
448462
const toRender = JSON.parse(
@@ -789,25 +803,32 @@
789803
<div class="control">
790804
<ColorPicker
791805
bind:hex="{$colourContext.background}"
792-
on:input="{(event) =>
793-
colourContext.update((v) => ({
794-
...v,
795-
background: event.detail.hex,
796-
}))}"
806+
on:change="{handleBackgroundChange}"
807+
position="responsive"
808+
/>
809+
</div>
810+
</div>
811+
<div class="column">
812+
<label class="label">Board</label>
813+
<div class="control">
814+
<ColorPicker
815+
bind:hex="{$colourContext.board}"
816+
on:change="{(e) =>
817+
e.detail.hex &&
818+
colourContext.update((v) => ({ ...v, board: e.detail.hex }))}"
797819
position="responsive"
798820
/>
799821
</div>
822+
<div class="help">Used for board fills</div>
800823
</div>
801824
<div class="column">
802825
<label class="label">Strokes</label>
803826
<div class="control">
804827
<ColorPicker
805828
bind:hex="{$colourContext.strokes}"
806-
on:input="{(event) =>
807-
colourContext.update((v) => ({
808-
...v,
809-
strokes: event.detail.hex,
810-
}))}"
829+
on:change="{(e) =>
830+
e.detail.hex &&
831+
colourContext.update((v) => ({ ...v, strokes: e.detail.hex }))}"
811832
position="responsive"
812833
/>
813834
</div>
@@ -817,11 +838,9 @@
817838
<div class="control">
818839
<ColorPicker
819840
bind:hex="{$colourContext.labels}"
820-
on:input="{(event) =>
821-
colourContext.update((v) => ({
822-
...v,
823-
labels: event.detail.hex,
824-
}))}"
841+
on:change="{(e) =>
842+
e.detail.hex &&
843+
colourContext.update((v) => ({ ...v, labels: e.detail.hex }))}"
825844
position="responsive"
826845
/>
827846
</div>
@@ -831,11 +850,9 @@
831850
<div class="control">
832851
<ColorPicker
833852
bind:hex="{$colourContext.fill}"
834-
on:input="{(event) =>
835-
colourContext.update((v) => ({
836-
...v,
837-
fill: event.detail.hex,
838-
}))}"
853+
on:change="{(e) =>
854+
e.detail.hex &&
855+
colourContext.update((v) => ({ ...v, fill: e.detail.hex }))}"
839856
position="responsive"
840857
/>
841858
</div>

src/stores/writeContext.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export const defaultContext: IColourContext = {
88
labels: "#000",
99
annotations: "#000",
1010
fill: "#000",
11+
board: "#fff",
1112
};
1213

1314
let initialState: IColourContext = {
@@ -17,6 +18,7 @@ let initialState: IColourContext = {
1718
labels: "#000",
1819
annotations: "#000",
1920
fill: "#000",
21+
board: "#fff",
2022
};
2123

2224
if (localStorage.getItem("context") !== null) {

0 commit comments

Comments
 (0)