Skip to content

Commit

Permalink
feat(board): allow to set icon color of widgets (#2228)
Browse files Browse the repository at this point in the history
Co-authored-by: Andre Silva <[email protected]>
  • Loading branch information
Aandree5 and Andre Silva authored Feb 19, 2025
1 parent 58babbf commit de5c34a
Show file tree
Hide file tree
Showing 23 changed files with 3,790 additions and 38 deletions.
3 changes: 2 additions & 1 deletion apps/nextjs/src/app/[locale]/boards/(content)/_theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import type { PropsWithChildren } from "react";
import type { MantineColorsTuple } from "@mantine/core";
import { createTheme, darken, lighten, MantineProvider } from "@mantine/core";
import { colorsTuple, createTheme, darken, lighten, MantineProvider } from "@mantine/core";

import { useRequiredBoard } from "@homarr/boards/context";
import type { ColorScheme } from "@homarr/definitions";
Expand All @@ -20,6 +20,7 @@ export const BoardMantineProvider = ({
colors: {
primaryColor: generateColors(board.primaryColor),
secondaryColor: generateColors(board.secondaryColor),
iconColor: board.iconColor ? generateColors(board.iconColor) : colorsTuple("#000000"),
},
primaryColor: "primaryColor",
autoContrast: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const ColorSettingsContent = ({ board }: Props) => {
primaryColor: board.primaryColor,
secondaryColor: board.secondaryColor,
opacity: board.opacity,
iconColor: board.iconColor ?? "",
itemRadius: board.itemRadius,
},
});
Expand Down Expand Up @@ -101,6 +102,12 @@ export const ColorSettingsContent = ({ board }: Props) => {
</InputWrapper>
</Grid.Col>
<Grid.Col span={{ sm: 12, md: 6 }}>
<ColorInput
label={t("board.field.iconColor.label")}
format="hex"
swatches={Object.values(theme.colors).map((color) => color[6])}
{...form.getInputProps("iconColor")}
/>
<Select
label={t("board.field.itemRadius.label")}
description={t("board.field.itemRadius.description")}
Expand Down
1 change: 1 addition & 0 deletions packages/api/src/router/board.ts
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ export const boardRouter = createTRPCRouter({
primaryColor: input.primaryColor,
secondaryColor: input.secondaryColor,
opacity: input.opacity,
iconColor: input.iconColor,

// custom css
customCss: input.customCss,
Expand Down
1 change: 1 addition & 0 deletions packages/db/migrations/mysql/0027_acoustic_karma.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE `board` ADD `icon_color` text;
Loading

0 comments on commit de5c34a

Please sign in to comment.