Skip to content

Commit

Permalink
Keep the palettes first colours in sync ⏱️.
Browse files Browse the repository at this point in the history
  • Loading branch information
gmarty committed May 19, 2024
1 parent 7ac6ebd commit 8358b4a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/containers/RoomsContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,14 @@ const RoomsContainer = ({ rooms, roomgfx, globdata }) => {

const updatePalette = (i, colourId) => {
const newRoom = structuredClone(room);
newRoom.nametable.palette[i] = colourId;
if (i % 4 === 0) {
// Keep the first colours in sync.
for (let i = 0; i < 16; i += 4) {
newRoom.nametable.palette[i] = colourId;
}
} else {
newRoom.nametable.palette[i] = colourId;
}
setRoom(newRoom);
};

Expand Down

0 comments on commit 8358b4a

Please sign in to comment.