Skip to content

Commit

Permalink
Add pixelaw theme preset (#319)
Browse files Browse the repository at this point in the history
  • Loading branch information
JunichiSugiura authored May 30, 2024
1 parent ad76970 commit 2d2b26f
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 6 deletions.
10 changes: 5 additions & 5 deletions examples/starknet-react-next/src/components/StarknetProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ export function StarknetProvider({ children }: PropsWithChildren) {

const url =
!process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL ||
process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL.split(".")[0] ===
process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL.split(".")[0] ===
"cartridge-starknet-react-next"
? process.env.XFRAME_URL
: "https://" +
(process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL ?? "").replace(
"cartridge-starknet-react-next",
"keychain",
);
(process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL ?? "").replace(
"cartridge-starknet-react-next",
"keychain",
);

const connectors = [
new CartridgeConnector(
Expand Down
10 changes: 10 additions & 0 deletions packages/controller/src/presets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ export const defaultPresets: ControllerThemePresets = {
primary: "#B0CAF8",
},
},
pixelaw: {
id: "pixelaw",
name: "Pixelaw",
icon: "/whitelabel/pixelaw/icon.svg",
cover: "/whitelabel/pixelaw/cover.png",
colors: {
primary: "#7C00B1",
primaryForeground: "white",
},
},
rollyourown: {
id: "rollyourown",
name: "Roll Your Own",
Expand Down
1 change: 1 addition & 0 deletions packages/controller/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ export type ControllerThemePreset = Omit<ControllerTheme, "colorMode"> & {

export type ControllerColors = {
primary?: ControllerColor;
primaryForeground?: ControllerColor;
};

export type ControllerColor = ThemeValue<string>;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions packages/keychain/public/whitelabel/pixelaw/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/keychain/src/hooks/theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ export function useChakraTheme(preset: ControllerThemePreset) {
primary:
toThemeColor(preset?.colors?.primary) ??
CartridgeTheme.semanticTokens.colors.brand.primary,
primaryForeground:
toThemeColor(preset?.colors?.primaryForeground) ??
CartridgeTheme.semanticTokens.colors.solid.bg,
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/theme/components/Button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function getColorProps({ colorScheme }: StyleFunctionProps) {
switch (colorScheme as ButtonColorScheme) {
case "colorful":
return {
color: "solid.bg",
color: "brand.primaryForeground",
bg: "brand.primary",
_hover: {
opacity: 0.8,
Expand Down
4 changes: 4 additions & 0 deletions packages/ui/src/theme/semanticTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ export const semanticTokens = {
default: "darkGray.700",
_light: "blueGray.200",
},
primaryForeground: {
default: "darkGray.800",
_light: "blueGray.100",
},
secondary: {
default: "darkGray.600",
_light: "blueGray.300",
Expand Down

0 comments on commit 2d2b26f

Please sign in to comment.