diff --git a/src/Home.tsx b/src/Home.tsx
index 0cd55d9..c102865 100644
--- a/src/Home.tsx
+++ b/src/Home.tsx
@@ -166,8 +166,9 @@ const Home: FunctionComponent<{ initial?: number }> = ({ initial = 0 }) => {
const renderNewGameButton = () => {
const newGame = (
);
@@ -191,7 +192,7 @@ const Home: FunctionComponent<{ initial?: number }> = ({ initial = 0 }) => {
display: "flex",
flexDirection: "column",
alignItems: "center",
- background: "#EEEEEE",
+ background: context.themeManager.theme.background,
flex: "1",
}}
>
@@ -205,8 +206,8 @@ const Home: FunctionComponent<{ initial?: number }> = ({ initial = 0 }) => {
borderTopRightRadius: "1vw",
minWidth: "10vw",
minHeight: "1vw",
- background: "#2F2504",
- color: "white",
+ background: context.themeManager.theme.primary,
+ color: context.themeManager.theme.primaryLight,
}}
>
{connectionStateText()}
@@ -215,7 +216,7 @@ const Home: FunctionComponent<{ initial?: number }> = ({ initial = 0 }) => {
= ({ initial = 0 }) => {
!crashMessage &&
(game?.state === "playing" || game?.state === "initial") && (
diff --git a/src/animation/PitAnimator.ts b/src/animation/PitAnimator.ts
index 8182ed5..3e912a7 100644
--- a/src/animation/PitAnimator.ts
+++ b/src/animation/PitAnimator.ts
@@ -12,6 +12,7 @@ import { v4 } from "uuid";
import { Context } from "../context";
import BoardViewModelFactory from "../factory/BoardViewModelFactory";
import { PitViewModelFactory } from "../factory/PitViewModelFactory";
+import { getColorByLuminance } from "../util/ColorUtil";
import BoardViewModel from "../viewmodel/BoardViewModel";
const animationUpdateInterval = 300;
@@ -130,6 +131,11 @@ export default class PitAnimator {
pitViewModel.pitColor = theme.pitGetRivalStonePitAnimateColor;
pitViewModel.stoneCount = 0;
}
+ pitViewModel.stoneColor = getColorByLuminance(
+ pitViewModel.pitColor,
+ theme.stoneColor,
+ theme.stoneLightColor
+ );
}
startAnimationUpdateCyle() {
@@ -165,7 +171,7 @@ export default class PitAnimator {
return game.board.pits.map((pit) => {
const theme = this.context.themeManager.theme;
const stoneCount = pit.stoneCount;
- const stoneColor = theme.ballColor;
+ const stoneColor = theme.stoneColor;
const pitColor = theme.holeColor;
const id = pit.index.toString();
return PitViewModelFactory.create({
diff --git a/src/components/BoardView.tsx b/src/components/BoardView.tsx
index 573a8d3..1396aa7 100644
--- a/src/components/BoardView.tsx
+++ b/src/components/BoardView.tsx
@@ -2,6 +2,7 @@ import { Bank, MancalaGame, Pit } from "mancala.js";
import * as React from "react";
import { FunctionComponent, useState } from "react";
import { Context } from "../context";
+import { getColorByLuminance } from "../util/ColorUtil";
import BoardViewModel from "../viewmodel/BoardViewModel";
import PitViewModel from "../viewmodel/PitViewModel";
@@ -67,6 +68,11 @@ const StoreView: FunctionComponent<{
const balls = [...range(pitViewModel.stoneCount)].map((i) => (
));
+ const textColor = getColorByLuminance(
+ pitViewModel.pitColor,
+ context.themeManager.theme.primary,
+ context.themeManager.theme.primaryLight
+ );
return (
{balls.length}
diff --git a/src/components/Button.tsx b/src/components/Button.tsx
index 6a2c361..3ff6867 100644
--- a/src/components/Button.tsx
+++ b/src/components/Button.tsx
@@ -1,17 +1,25 @@
import * as React from "react";
import { FunctionComponent } from "react";
+import { Context } from "../context";
+import { getColorByLuminance } from "../util/ColorUtil";
const Button: FunctionComponent<{
+ context: Context;
text: String;
onClick: () => void;
color: string;
-}> = ({ text, color, onClick }) => {
+}> = ({ context, text, color, onClick }) => {
+ const textColor = getColorByLuminance(
+ color,
+ context.themeManager.theme.primary,
+ context.themeManager.theme.primaryLight
+ );
return (