Skip to content

A local-first personal finance app

make colours on reports page consistent (#6672)

Matt Fiddamana35fdf4d1866
diff --git a/packages/component-library/src/theme.ts b/packages/component-library/src/theme.ts
index 0059ae70c4..af19b53d66 100644
--- a/packages/component-library/src/theme.ts
+++ b/packages/component-library/src/theme.ts
@@ -187,6 +187,10 @@ export const theme = {
reportsGray: 'var(--color-reportsGray)',
reportsLabel: 'var(--color-reportsLabel)',
reportsInnerLabel: 'var(--color-reportsInnerLabel)',
+ reportsChartFill: 'var(--color-reportsChartFill)',
+ reportsNumberPositive: 'var(--color-reportsNumberPositive)',
+ reportsNumberNegative: 'var(--color-reportsNumberNegative)',
+ reportsNumberNeutral: 'var(--color-reportsNumberNeutral)',
noteTagBackground: 'var(--color-noteTagBackground)',
noteTagBackgroundHover: 'var(--color-noteTagBackgroundHover)',
noteTagDefault: 'var(--color-noteTagDefault)',
diff --git a/packages/desktop-client/e2e/command-bar.test.ts-snapshots/Command-bar-Check-the-command-bar-search-works-correctly-1-chromium-linux.png b/packages/desktop-client/e2e/command-bar.test.ts-snapshots/Command-bar-Check-the-command-bar-search-works-correctly-1-chromium-linux.png
index 65c002cbff..5a6a13043f 100644
Binary files a/packages/desktop-client/e2e/command-bar.test.ts-snapshots/Command-bar-Check-the-command-bar-search-works-correctly-1-chromium-linux.png and b/packages/desktop-client/e2e/command-bar.test.ts-snapshots/Command-bar-Check-the-command-bar-search-works-correctly-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/command-bar.test.ts-snapshots/Command-bar-Check-the-command-bar-search-works-correctly-2-chromium-linux.png b/packages/desktop-client/e2e/command-bar.test.ts-snapshots/Command-bar-Check-the-command-bar-search-works-correctly-2-chromium-linux.png
index 0fa42dd360..e2303b87d9 100644
Binary files a/packages/desktop-client/e2e/command-bar.test.ts-snapshots/Command-bar-Check-the-command-bar-search-works-correctly-2-chromium-linux.png and b/packages/desktop-client/e2e/command-bar.test.ts-snapshots/Command-bar-Check-the-command-bar-search-works-correctly-2-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/command-bar.test.ts-snapshots/Command-bar-Check-the-command-bar-search-works-correctly-3-chromium-linux.png b/packages/desktop-client/e2e/command-bar.test.ts-snapshots/Command-bar-Check-the-command-bar-search-works-correctly-3-chromium-linux.png
index 3aeadb2006..3d0d88a96b 100644
Binary files a/packages/desktop-client/e2e/command-bar.test.ts-snapshots/Command-bar-Check-the-command-bar-search-works-correctly-3-chromium-linux.png and b/packages/desktop-client/e2e/command-bar.test.ts-snapshots/Command-bar-Check-the-command-bar-search-works-correctly-3-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-and-cash-flow-reports-1-chromium-linux.png b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-and-cash-flow-reports-1-chromium-linux.png
index 709ad751e1..1483e1792b 100644
Binary files a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-and-cash-flow-reports-1-chromium-linux.png and b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-and-cash-flow-reports-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-and-cash-flow-reports-2-chromium-linux.png b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-and-cash-flow-reports-2-chromium-linux.png
index 079d44edce..6d9cd29f45 100644
Binary files a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-and-cash-flow-reports-2-chromium-linux.png and b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-and-cash-flow-reports-2-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-and-cash-flow-reports-3-chromium-linux.png b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-and-cash-flow-reports-3-chromium-linux.png
index d2a5770057..4643913a16 100644
Binary files a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-and-cash-flow-reports-3-chromium-linux.png and b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-and-cash-flow-reports-3-chromium-linux.png differ
diff --git a/packages/desktop-client/src/components/FinancialText.tsx b/packages/desktop-client/src/components/FinancialText.tsx
index dad89ba0af..98fa1391f6 100644
--- a/packages/desktop-client/src/components/FinancialText.tsx
+++ b/packages/desktop-client/src/components/FinancialText.tsx
@@ -6,7 +6,7 @@ import { Text } from '@actual-app/components/text';
type FinancialTextProps<T extends ElementType = typeof Text> = {
as?: T;
style?: CSSProperties;
-} & Omit<ComponentPropsWithoutRef<T>, 'style'>;
+} & Omit<ComponentPropsWithoutRef<T>, 'style' | 'as'>;
export function FinancialText<T extends ElementType = typeof Text>({
as,
diff --git a/packages/desktop-client/src/components/reports/Change.test.tsx b/packages/desktop-client/src/components/reports/Change.test.tsx
index 697ac2249e..2e6324f590 100644
--- a/packages/desktop-client/src/components/reports/Change.test.tsx
+++ b/packages/desktop-client/src/components/reports/Change.test.tsx
@@ -9,7 +9,7 @@ import { Change } from './Change';
import { store } from '@desktop-client/redux/store';
describe('Change', () => {
- it('renders a positive amount with a plus sign and green color', () => {
+ it('renders a positive amount with a plus sign and positive color', () => {
render(
<Provider store={store}>
<Change amount={12345} />
@@ -17,10 +17,10 @@ describe('Change', () => {
);
const el = screen.getByText('+123.45');
expect(el).toBeInTheDocument();
- expect(el).toHaveStyle(`color: ${theme.noticeTextLight}`);
+ expect(el).toHaveStyle(`color: ${theme.reportsNumberPositive}`);
});
- it('renders zero with a plus sign and green color', () => {
+ it('renders zero with a plus sign and neutral color', () => {
render(
<Provider store={store}>
<Change amount={0} />
@@ -28,10 +28,10 @@ describe('Change', () => {
);
const el = screen.getByText('+0.00');
expect(el).toBeInTheDocument();
- expect(el).toHaveStyle(`color: ${theme.noticeTextLight}`);
+ expect(el).toHaveStyle(`color: ${theme.reportsNumberNeutral}`);
});
- it('renders a negative amount with a minus sign and red color', () => {
+ it('renders a negative amount with a minus sign and negative color', () => {
render(
<Provider store={store}>
<Change amount={-9876} />
@@ -39,7 +39,7 @@ describe('Change', () => {
);
const el = screen.getByText('-98.76');
expect(el).toBeInTheDocument();
- expect(el).toHaveStyle(`color: ${theme.errorText}`);
+ expect(el).toHaveStyle(`color: ${theme.reportsNumberNegative}`);
});
it('merges custom style prop', () => {
@@ -50,6 +50,6 @@ describe('Change', () => {
);
const el = screen.getByText('+10.00');
expect(el).toHaveStyle('font-weight: bold');
- expect(el).toHaveStyle(`color: ${theme.noticeTextLight}`);
+ expect(el).toHaveStyle(`color: ${theme.reportsNumberPositive}`);
});
});
diff --git a/packages/desktop-client/src/components/reports/Change.tsx b/packages/desktop-client/src/components/reports/Change.tsx
index 6de1f342a5..fc0a62dae8 100644
--- a/packages/desktop-client/src/components/reports/Change.tsx
+++ b/packages/desktop-client/src/components/reports/Change.tsx
@@ -15,18 +15,23 @@ export function Change({
style?: CSSProperties;
}) {
const format = useFormat();
- const textStyle = {
- ...styles.smallText,
- color: amount < 0 ? theme.errorText : theme.noticeTextLight,
- ...style,
- };
return (
- <Block style={textStyle}>
- <FinancialText style={textStyle}>
- {amount >= 0 ? '+' : ''}
- {format(amount, 'financial')}
- </FinancialText>
- </Block>
+ <FinancialText
+ as={Block}
+ style={{
+ ...styles.smallText,
+ color:
+ amount === 0
+ ? theme.reportsNumberNeutral
+ : amount < 0
+ ? theme.reportsNumberNegative
+ : theme.reportsNumberPositive,
+ ...style,
+ }}
+ >
+ {amount >= 0 ? '+' : ''}
+ {format(amount, 'financial')}
+ </FinancialText>
);
}
diff --git a/packages/desktop-client/src/components/reports/FormulaResult.tsx b/packages/desktop-client/src/components/reports/FormulaResult.tsx
index d01767c91b..5ee4d88158 100644
--- a/packages/desktop-client/src/components/reports/FormulaResult.tsx
+++ b/packages/desktop-client/src/components/reports/FormulaResult.tsx
@@ -14,7 +14,6 @@ import debounce from 'lodash/debounce';
import { amountToInteger } from 'loot-core/shared/util';
-import { chartTheme } from './chart-theme';
import { LoadingIndicator } from './LoadingIndicator';
import { PrivacyFilter } from '@desktop-client/components/PrivacyFilter';
@@ -152,7 +151,7 @@ export function FormulaResult({
const color = customColor
? customColor
: error
- ? chartTheme.colors.red
+ ? theme.errorText
: theme.pageText;
return (
diff --git a/packages/desktop-client/src/components/reports/SummaryNumber.tsx b/packages/desktop-client/src/components/reports/SummaryNumber.tsx
index e965269590..b97c58974e 100644
--- a/packages/desktop-client/src/components/reports/SummaryNumber.tsx
+++ b/packages/desktop-client/src/components/reports/SummaryNumber.tsx
@@ -1,10 +1,10 @@
import React, { useRef, useState, type Ref } from 'react';
import { useTranslation } from 'react-i18next';
+import { theme } from '@actual-app/components/theme';
import { View } from '@actual-app/components/view';
import debounce from 'lodash/debounce';
-import { chartTheme } from './chart-theme';
import { LoadingIndicator } from './LoadingIndicator';
import { FinancialText } from '@desktop-client/components/FinancialText';
@@ -76,9 +76,11 @@ export function SummaryNumber({
<View
ref={mergedRef as Ref<HTMLDivElement>}
aria-label={
- value < 0
- ? t('Negative amount: {{amount}}', { amount: displayAmount })
- : t('Positive amount: {{amount}}', { amount: displayAmount })
+ value === 0
+ ? t('Zero amount')
+ : value < 0
+ ? t('Negative amount: {{amount}}', { amount: displayAmount })
+ : t('Positive amount: {{amount}}', { amount: displayAmount })
}
style={{
alignItems: 'center',
@@ -92,7 +94,12 @@ export function SummaryNumber({
margin: `${CONTAINER_MARGIN}px 0`,
justifyContent: 'center',
transition: animate ? 'font-size 0.3s ease' : '',
- color: value < 0 ? chartTheme.colors.red : chartTheme.colors.blue,
+ color:
+ value === 0
+ ? theme.reportsNumberNeutral
+ : value < 0
+ ? theme.reportsNumberNegative
+ : theme.reportsNumberPositive,
}}
>
<FinancialText aria-hidden="true">
diff --git a/packages/desktop-client/src/components/reports/chart-theme.ts b/packages/desktop-client/src/components/reports/chart-theme.ts
index 95eb81c808..d0ce664fd1 100644
--- a/packages/desktop-client/src/components/reports/chart-theme.ts
+++ b/packages/desktop-client/src/components/reports/chart-theme.ts
@@ -1,119 +1,5 @@
-import { theme } from '@actual-app/components/theme';
-
import { useIsTestEnv } from '@desktop-client/hooks/useIsTestEnv';
-const colorFades = {
- blueFadeStart: 'rgba(229, 245, 255, 1)',
- blueFadeEnd: 'rgba(229, 245, 255, 0)',
- redFadeStart: 'rgba(255, 243, 242, 1)',
- redFadeEnd: 'rgba(255, 243, 242, 0)',
-};
-
-// Typography
-const sansSerif =
- 'Inter Variable, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, Helvetica, Arial, sans-serif';
-const letterSpacing = 'normal';
-const fontSize = 13;
-
-// Labels
-const baseLabelStyles = {
- fontFamily: sansSerif,
- fontSize,
- letterSpacing,
- fill: theme.reportsLabel,
- stroke: 'transparent',
-};
-
-const axisBaseStyles = {
- axis: {
- fill: 'transparent',
- stroke: 'none',
- },
- grid: {
- fill: 'none',
- stroke: 'none',
- pointerEvents: 'none',
- },
- ticks: {
- fill: 'transparent',
- size: 1,
- stroke: 'none',
- },
- axisLabel: baseLabelStyles,
- tickLabels: baseLabelStyles,
-};
-
-export const chartTheme = {
- colors: {
- ...colorFades,
- red: theme.reportsRed,
- blue: theme.reportsBlue,
- },
- area: {
- style: {
- labels: baseLabelStyles,
- data: {
- stroke: theme.reportsBlue,
- strokeWidth: 2,
- strokeLinejoin: 'round',
- strokeLinecap: 'round',
- },
- },
- },
- axis: {
- style: axisBaseStyles,
- },
- dependentAxis: {
- style: {
- ...axisBaseStyles,
- grid: {
- ...axisBaseStyles.grid,
- stroke: theme.pageTextSubdued,
- strokeDasharray: '1,1',
- },
- tickLabels: { ...baseLabelStyles, padding: 5 },
- },
- },
- independentAxis: {
- style: {
- ...axisBaseStyles,
- axis: { ...axisBaseStyles.axis, stroke: theme.pageTextSubdued },
- tickLabels: { ...baseLabelStyles, padding: 10 },
- },
- },
- bar: {
- style: {
- labels: baseLabelStyles,
- data: { fill: theme.reportsBlue, stroke: 'none' },
- },
- },
- line: {
- style: {
- labels: baseLabelStyles,
- data: {
- fill: 'none',
- stroke: theme.reportsBlue,
- strokeWidth: 2,
- strokeLinejoin: 'round',
- strokeLinecap: 'round',
- },
- },
- },
- voronoi: {
- style: {
- labels: baseLabelStyles,
- },
- },
- chart: {
- padding: {
- top: 20,
- left: 65,
- right: 20,
- bottom: 50,
- },
- },
-};
-
export function getColorScale(name: string): string[] {
const scales: Record<string, string[]> = {
grayscale: ['#cccccc', '#969696', '#636363', '#252525'],
diff --git a/packages/desktop-client/src/components/reports/graphs/AreaGraph.tsx b/packages/desktop-client/src/components/reports/graphs/AreaGraph.tsx
index 3722d356cf..7172f212b4 100644
--- a/packages/desktop-client/src/components/reports/graphs/AreaGraph.tsx
+++ b/packages/desktop-client/src/components/reports/graphs/AreaGraph.tsx
@@ -289,12 +289,12 @@ export function AreaGraph({
>
<stop
offset={off}
- stopColor={theme.reportsBlue}
+ stopColor={theme.reportsNumberPositive}
stopOpacity={0.2}
/>
<stop
offset={off}
- stopColor={theme.reportsRed}
+ stopColor={theme.reportsNumberNegative}
stopOpacity={0.2}
/>
</linearGradient>
@@ -307,12 +307,12 @@ export function AreaGraph({
>
<stop
offset={off}
- stopColor={theme.reportsBlue}
+ stopColor={theme.reportsNumberPositive}
stopOpacity={1}
/>
<stop
offset={off}
- stopColor={theme.reportsRed}
+ stopColor={theme.reportsNumberNegative}
stopOpacity={1}
/>
</linearGradient>
diff --git a/packages/desktop-client/src/components/reports/graphs/CalendarGraph.tsx b/packages/desktop-client/src/components/reports/graphs/CalendarGraph.tsx
index 5b33a792f4..fac6960bec 100644
--- a/packages/desktop-client/src/components/reports/graphs/CalendarGraph.tsx
+++ b/packages/desktop-client/src/components/reports/graphs/CalendarGraph.tsx
@@ -19,7 +19,6 @@ import { type SyncedPrefs } from 'loot-core/types/prefs';
import { FinancialText } from '@desktop-client/components/FinancialText';
import { PrivacyFilter } from '@desktop-client/components/PrivacyFilter';
-import { chartTheme } from '@desktop-client/components/reports/chart-theme';
import { useFormat } from '@desktop-client/hooks/useFormat';
import { useResizeObserver } from '@desktop-client/hooks/useResizeObserver';
@@ -138,7 +137,7 @@ export function CalendarGraph({
</View>
<View
style={{
- color: chartTheme.colors.blue,
+ color: theme.reportsNumberPositive,
flexDirection: 'row',
}}
>
@@ -169,7 +168,7 @@ export function CalendarGraph({
</View>
<View
style={{
- color: chartTheme.colors.red,
+ color: theme.reportsNumberNegative,
flexDirection: 'row',
}}
>
@@ -271,7 +270,7 @@ function DayButton({ day, onPress, fontSize, resizeRef }: DayButtonProps) {
position: 'absolute',
width: '50%',
height: '100%',
- background: chartTheme.colors.red,
+ background: theme.reportsNumberNegative,
opacity: 0.2,
right: 0,
}}
@@ -283,7 +282,7 @@ function DayButton({ day, onPress, fontSize, resizeRef }: DayButtonProps) {
position: 'absolute',
width: '50%',
height: '100%',
- background: chartTheme.colors.blue,
+ background: theme.reportsNumberPositive,
opacity: 0.2,
left: 0,
}}
@@ -296,7 +295,7 @@ function DayButton({ day, onPress, fontSize, resizeRef }: DayButtonProps) {
bottom: 0,
opacity: 0.9,
height: `${Math.ceil(day.incomeSize)}%`,
- backgroundColor: chartTheme.colors.blue,
+ backgroundColor: theme.reportsNumberPositive,
width: '50%',
transition: 'height 0.5s ease-out',
}}
@@ -309,7 +308,7 @@ function DayButton({ day, onPress, fontSize, resizeRef }: DayButtonProps) {
bottom: 0,
opacity: 0.9,
height: `${Math.ceil(day.expenseSize)}%`,
- backgroundColor: chartTheme.colors.red,
+ backgroundColor: theme.reportsNumberNegative,
width: '50%',
transition: 'height 0.5s ease-out',
}}
diff --git a/packages/desktop-client/src/components/reports/graphs/CashFlowGraph.tsx b/packages/desktop-client/src/components/reports/graphs/CashFlowGraph.tsx
index d213808217..a395cd63df 100644
--- a/packages/desktop-client/src/components/reports/graphs/CashFlowGraph.tsx
+++ b/packages/desktop-client/src/components/reports/graphs/CashFlowGraph.tsx
@@ -17,10 +17,7 @@ import {
} from 'recharts';
import { FinancialText } from '@desktop-client/components/FinancialText';
-import {
- chartTheme,
- useRechartsAnimation,
-} from '@desktop-client/components/reports/chart-theme';
+import { useRechartsAnimation } from '@desktop-client/components/reports/chart-theme';
import { Container } from '@desktop-client/components/reports/Container';
import { useFormat, type FormatType } from '@desktop-client/hooks/useFormat';
import { useLocale } from '@desktop-client/hooks/useLocale';
@@ -204,14 +201,14 @@ export function CashFlowGraph({
<Bar
dataKey="income"
stackId="a"
- fill={chartTheme.colors.blue}
+ fill={theme.reportsNumberPositive}
maxBarSize={MAX_BAR_SIZE}
{...animationProps}
/>
<Bar
dataKey="expenses"
stackId="a"
- fill={chartTheme.colors.red}
+ fill={theme.reportsNumberNegative}
maxBarSize={MAX_BAR_SIZE}
{...animationProps}
/>
diff --git a/packages/desktop-client/src/components/reports/graphs/CrossoverGraph.tsx b/packages/desktop-client/src/components/reports/graphs/CrossoverGraph.tsx
index 1c013e8566..e8247a1546 100644
--- a/packages/desktop-client/src/components/reports/graphs/CrossoverGraph.tsx
+++ b/packages/desktop-client/src/components/reports/graphs/CrossoverGraph.tsx
@@ -219,7 +219,7 @@ export function CrossoverGraph({
type="monotone"
dataKey="investmentIncome"
dot={false}
- stroke={theme.reportsBlue}
+ stroke={theme.reportsNumberPositive}
strokeWidth={2}
{...animationProps}
/>
@@ -227,7 +227,7 @@ export function CrossoverGraph({
type="monotone"
dataKey="expenses"
dot={false}
- stroke={theme.reportsRed}
+ stroke={theme.reportsNumberNegative}
strokeWidth={2}
{...animationProps}
/>
@@ -235,7 +235,7 @@ export function CrossoverGraph({
type="monotone"
dataKey="adjustedExpenses"
dot={false}
- stroke={theme.reportsRed}
+ stroke={theme.reportsNumberNegative}
strokeWidth={2}
strokeDasharray="5 5"
{...animationProps}
diff --git a/packages/desktop-client/src/components/reports/graphs/NetWorthGraph.tsx b/packages/desktop-client/src/components/reports/graphs/NetWorthGraph.tsx
index 43819d7656..b419961717 100644
--- a/packages/desktop-client/src/components/reports/graphs/NetWorthGraph.tsx
+++ b/packages/desktop-client/src/components/reports/graphs/NetWorthGraph.tsx
@@ -226,12 +226,12 @@ export function NetWorthGraph({
<linearGradient id={gradientId} x1="0" y1="0" x2="0" y2="1">
<stop
offset={off}
- stopColor={theme.reportsBlue}
+ stopColor={theme.reportsChartFill}
stopOpacity={0.2}
/>
<stop
offset={off}
- stopColor={theme.reportsRed}
+ stopColor={theme.reportsNumberNegative}
stopOpacity={0.2}
/>
</linearGradient>
@@ -243,7 +243,7 @@ export function NetWorthGraph({
activeDot={false}
{...animationProps}
dataKey="y"
- stroke={theme.reportsBlue}
+ stroke={theme.reportsChartFill}
strokeWidth={2}
fill={`url(#${gradientId})`}
fillOpacity={1}
diff --git a/packages/desktop-client/src/components/reports/graphs/SpendingGraph.tsx b/packages/desktop-client/src/components/reports/graphs/SpendingGraph.tsx
index c09a684106..7919dae552 100644
--- a/packages/desktop-client/src/components/reports/graphs/SpendingGraph.tsx
+++ b/packages/desktop-client/src/components/reports/graphs/SpendingGraph.tsx
@@ -290,7 +290,7 @@ export function SpendingGraph({
>
<stop
offset={gradientOffset()}
- stopColor={theme.reportsGreen}
+ stopColor={theme.reportsChartFill}
stopOpacity={0.2}
/>
</linearGradient>
@@ -303,7 +303,7 @@ export function SpendingGraph({
>
<stop
offset={gradientOffset()}
- stopColor={theme.reportsGreen}
+ stopColor={theme.reportsChartFill}
stopOpacity={1}
/>
</linearGradient>
@@ -313,7 +313,7 @@ export function SpendingGraph({
type="linear"
dot={false}
activeDot={{
- fill: theme.reportsGreen,
+ fill: theme.reportsChartFill,
fillOpacity: 1,
r: 10,
}}
diff --git a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableRow.tsx b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableRow.tsx
index 4bd9e497c9..025985e480 100644
--- a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableRow.tsx
+++ b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableRow.tsx
@@ -46,8 +46,8 @@ type ReportTableRowProps = {
};
const getAmountColor = (amount: number) => {
- if (amount === 0) return undefined;
- return amount > 0 ? theme.noticeText : theme.errorText;
+ if (amount === 0) return theme.reportsNumberNeutral;
+ return amount > 0 ? theme.reportsNumberPositive : theme.reportsNumberNegative;
};
export const ReportTableRow = memo(
diff --git a/packages/desktop-client/src/components/reports/reports/Calendar.tsx b/packages/desktop-client/src/components/reports/reports/Calendar.tsx
index 60d1f45f13..41ac9ec091 100644
--- a/packages/desktop-client/src/components/reports/reports/Calendar.tsx
+++ b/packages/desktop-client/src/components/reports/reports/Calendar.tsx
@@ -46,7 +46,6 @@ import {
PageHeader,
} from '@desktop-client/components/Page';
import { PrivacyFilter } from '@desktop-client/components/PrivacyFilter';
-import { chartTheme } from '@desktop-client/components/reports/chart-theme';
import { DateRange } from '@desktop-client/components/reports/DateRange';
import { CalendarGraph } from '@desktop-client/components/reports/graphs/CalendarGraph';
import { Header } from '@desktop-client/components/reports/Header';
@@ -860,11 +859,11 @@ function CalendarWithHeader({
<SvgArrowThickUp
width={16}
height={16}
- style={{ color: chartTheme.colors.blue, flexShrink: 0 }}
+ style={{ color: theme.reportsNumberPositive, flexShrink: 0 }}
/>
<View
style={{
- color: chartTheme.colors.blue,
+ color: theme.reportsNumberPositive,
flexDirection: 'row',
flexGrow: 1,
justifyContent: 'start',
@@ -880,11 +879,11 @@ function CalendarWithHeader({
<SvgArrowThickDown
width={16}
height={16}
- style={{ color: chartTheme.colors.red, flexShrink: 0 }}
+ style={{ color: theme.reportsNumberNegative, flexShrink: 0 }}
/>
<View
style={{
- color: chartTheme.colors.red,
+ color: theme.reportsNumberNegative,
flexDirection: 'row',
flexGrow: 1,
justifyContent: 'start',
@@ -986,12 +985,8 @@ function CalendarCardHeader({
>
<Trans>Income:</Trans>
</View>
- <View style={{ color: chartTheme.colors.blue }}>
- <PrivacyFilter>
- <FinancialText>
- {format(totalIncome, 'financial')}
- </FinancialText>
- </PrivacyFilter>
+ <View style={{ color: theme.reportsNumberPositive }}>
+ <PrivacyFilter>{format(totalIncome, 'financial')}</PrivacyFilter>
</View>
<View
@@ -1002,12 +997,8 @@ function CalendarCardHeader({
>
<Trans>Expenses:</Trans>
</View>
- <View style={{ color: chartTheme.colors.red }}>
- <PrivacyFilter>
- <FinancialText>
- {format(totalExpense, 'financial')}
- </FinancialText>
- </PrivacyFilter>
+ <View style={{ color: theme.reportsNumberNegative }}>
+ <PrivacyFilter>{format(totalExpense, 'financial')}</PrivacyFilter>
</View>
</View>
</View>
diff --git a/packages/desktop-client/src/components/reports/reports/CalendarCard.tsx b/packages/desktop-client/src/components/reports/reports/CalendarCard.tsx
index decfaab30c..eabf856120 100644
--- a/packages/desktop-client/src/components/reports/reports/CalendarCard.tsx
+++ b/packages/desktop-client/src/components/reports/reports/CalendarCard.tsx
@@ -31,7 +31,6 @@ import { type SyncedPrefs } from 'loot-core/types/prefs';
import { FinancialText } from '@desktop-client/components/FinancialText';
import { PrivacyFilter } from '@desktop-client/components/PrivacyFilter';
-import { chartTheme } from '@desktop-client/components/reports/chart-theme';
import { DateRange } from '@desktop-client/components/reports/DateRange';
import { CalendarGraph } from '@desktop-client/components/reports/graphs/CalendarGraph';
import { LoadingIndicator } from '@desktop-client/components/reports/LoadingIndicator';
@@ -251,7 +250,7 @@ export function CalendarCard({
>
<Trans>Income:</Trans>
</View>
- <View style={{ color: chartTheme.colors.blue }}>
+ <View style={{ color: theme.reportsNumberPositive }}>
{totalIncome !== 0 ? (
<PrivacyFilter>
<FinancialText>
@@ -274,7 +273,7 @@ export function CalendarCard({
>
<Trans>Expenses:</Trans>
</View>
- <View style={{ color: chartTheme.colors.red }}>
+ <View style={{ color: theme.reportsNumberNegative }}>
{totalExpense !== 0 ? (
<PrivacyFilter>
<FinancialText>
@@ -508,7 +507,7 @@ function CalendarCardInner({
>
<View
style={{
- color: chartTheme.colors.blue,
+ color: theme.reportsNumberPositive,
flexDirection: 'row',
fontSize: '10px',
marginRight: 10,
@@ -534,7 +533,7 @@ function CalendarCardInner({
</View>
<View
style={{
- color: chartTheme.colors.red,
+ color: theme.reportsNumberNegative,
flexDirection: 'row',
fontSize: '10px',
}}
diff --git a/packages/desktop-client/src/components/reports/reports/CashFlowCard.tsx b/packages/desktop-client/src/components/reports/reports/CashFlowCard.tsx
index 4c123a7d6f..13b7bc5b89 100644
--- a/packages/desktop-client/src/components/reports/reports/CashFlowCard.tsx
+++ b/packages/desktop-client/src/components/reports/reports/CashFlowCard.tsx
@@ -20,10 +20,7 @@ import { defaultTimeFrame } from './CashFlow';
import { FinancialText } from '@desktop-client/components/FinancialText';
import { PrivacyFilter } from '@desktop-client/components/PrivacyFilter';
import { Change } from '@desktop-client/components/reports/Change';
-import {
- chartTheme,
- useRechartsAnimation,
-} from '@desktop-client/components/reports/chart-theme';
+import { useRechartsAnimation } from '@desktop-client/components/reports/chart-theme';
import { Container } from '@desktop-client/components/reports/Container';
import { DateRange } from '@desktop-client/components/reports/DateRange';
import { LoadingIndicator } from '@desktop-client/components/reports/LoadingIndicator';
@@ -236,7 +233,7 @@ export function CashFlowCard({
>
<Bar
dataKey="income"
- fill={chartTheme.colors.blue}
+ fill={theme.reportsNumberPositive}
barSize={14}
{...animationProps}
>
@@ -249,7 +246,7 @@ export function CashFlowCard({
<Bar
dataKey="expenses"
- fill={chartTheme.colors.red}
+ fill={theme.reportsNumberNegative}
barSize={14}
{...animationProps}
>
diff --git a/packages/desktop-client/src/components/reports/reports/SpendingCard.tsx b/packages/desktop-client/src/components/reports/reports/SpendingCard.tsx
index 27c3ba6933..dcbc57aa5e 100644
--- a/packages/desktop-client/src/components/reports/reports/SpendingCard.tsx
+++ b/packages/desktop-client/src/components/reports/reports/SpendingCard.tsx
@@ -139,11 +139,12 @@ export function SpendingCard({
...styles.mediumText,
fontWeight: 500,
marginBottom: 5,
- color: !difference
- ? 'inherit'
- : difference <= 0
- ? theme.noticeTextLight
- : theme.errorText,
+ color:
+ difference === 0 || difference == null
+ ? theme.reportsNumberNeutral
+ : difference > 0
+ ? theme.reportsNumberPositive
+ : theme.reportsNumberNegative,
}}
>
<PrivacyFilter activationFilters={[!isCardHovered]}>
diff --git a/packages/desktop-client/src/components/reports/reports/Summary.tsx b/packages/desktop-client/src/components/reports/reports/Summary.tsx
index 569d841005..44157efd67 100644
--- a/packages/desktop-client/src/components/reports/reports/Summary.tsx
+++ b/packages/desktop-client/src/components/reports/reports/Summary.tsx
@@ -35,7 +35,6 @@ import {
PageHeader,
} from '@desktop-client/components/Page';
import { PrivacyFilter } from '@desktop-client/components/PrivacyFilter';
-import { chartTheme } from '@desktop-client/components/reports/chart-theme';
import { Header } from '@desktop-client/components/reports/Header';
import { LoadingIndicator } from '@desktop-client/components/reports/LoadingIndicator';
import { calculateTimeRange } from '@desktop-client/components/reports/reportRanges';
@@ -500,9 +499,11 @@ function SummaryInner({ widget }: SummaryInnerProps) {
fontSize: '50px',
justifyContent: 'center',
color:
- (data?.total ?? 0) < 0
- ? chartTheme.colors.red
- : chartTheme.colors.blue,
+ (data?.total ?? 0) === 0
+ ? theme.reportsNumberNeutral
+ : (data?.total ?? 0) < 0
+ ? theme.reportsNumberNegative
+ : theme.reportsNumberPositive,
}}
>
<PrivacyFilter>
diff --git a/packages/desktop-client/src/components/reports/spreadsheets/calculateLegend.ts b/packages/desktop-client/src/components/reports/spreadsheets/calculateLegend.ts
index fed7221d7f..e32f1c9709 100644
--- a/packages/desktop-client/src/components/reports/spreadsheets/calculateLegend.ts
+++ b/packages/desktop-client/src/components/reports/spreadsheets/calculateLegend.ts
@@ -33,18 +33,26 @@ export function calculateLegend(
if (groupBy === 'Interval') {
if (balanceTypeOp === 'totalDebts') {
- return theme.reportsRed;
+ return theme.reportsNumberNegative;
+ }
+
+ if (balanceTypeOp === 'netDebts') {
+ return theme.reportsNumberNegative;
}
if (balanceTypeOp === 'totalTotals') {
if (data.totalTotals < 0) {
- return theme.reportsRed;
+ return theme.reportsNumberNegative;
}
- return theme.reportsBlue;
+ return theme.reportsNumberPositive;
+ }
+
+ if (balanceTypeOp === 'totalAssets' || balanceTypeOp === 'netAssets') {
+ return theme.reportsNumberPositive;
}
- return theme.reportsBlue;
+ return theme.reportsChartFill;
}
return colorScale[index % colorScale.length];
diff --git a/packages/desktop-client/src/style/themes/dark.ts b/packages/desktop-client/src/style/themes/dark.ts
index 5b91c00778..c1d2d12b0f 100644
--- a/packages/desktop-client/src/style/themes/dark.ts
+++ b/packages/desktop-client/src/style/themes/dark.ts
@@ -198,6 +198,10 @@ export const reportsGreen = colorPalette.green400;
export const reportsGray = colorPalette.gray400;
export const reportsLabel = pageText;
export const reportsInnerLabel = colorPalette.navy800;
+export const reportsNumberNegative = reportsRed;
+export const reportsNumberNeutral = pageText;
+export const reportsNumberPositive = reportsGreen;
+export const reportsChartFill = reportsNumberPositive;
export const noteTagBackground = colorPalette.purple700;
export const noteTagBackgroundHover = colorPalette.purple500;
diff --git a/packages/desktop-client/src/style/themes/development.ts b/packages/desktop-client/src/style/themes/development.ts
index b0a2a0bf4c..13fe5d46d0 100644
--- a/packages/desktop-client/src/style/themes/development.ts
+++ b/packages/desktop-client/src/style/themes/development.ts
@@ -198,6 +198,10 @@ export const reportsGreen = colorPalette.green400;
export const reportsGray = colorPalette.gray400;
export const reportsLabel = colorPalette.navy900;
export const reportsInnerLabel = colorPalette.navy800;
+export const reportsNumberNegative = reportsRed;
+export const reportsNumberNeutral = pageText;
+export const reportsNumberPositive = reportsGreen;
+export const reportsChartFill = reportsNumberPositive;
export const noteTagBackground = colorPalette.purple125;
export const noteTagBackgroundHover = colorPalette.purple150;
diff --git a/packages/desktop-client/src/style/themes/light.ts b/packages/desktop-client/src/style/themes/light.ts
index 5f8a625b48..564b97220c 100644
--- a/packages/desktop-client/src/style/themes/light.ts
+++ b/packages/desktop-client/src/style/themes/light.ts
@@ -200,6 +200,10 @@ export const reportsGreen = colorPalette.green400;
export const reportsGray = colorPalette.gray400;
export const reportsLabel = colorPalette.navy900;
export const reportsInnerLabel = colorPalette.navy800;
+export const reportsNumberNegative = reportsRed;
+export const reportsNumberNeutral = pageText;
+export const reportsNumberPositive = reportsGreen;
+export const reportsChartFill = reportsNumberPositive;
export const noteTagBackground = colorPalette.purple125;
export const noteTagBackgroundHover = colorPalette.purple150;
diff --git a/packages/desktop-client/src/style/themes/midnight.ts b/packages/desktop-client/src/style/themes/midnight.ts
index decdf025b5..eced100288 100644
--- a/packages/desktop-client/src/style/themes/midnight.ts
+++ b/packages/desktop-client/src/style/themes/midnight.ts
@@ -200,6 +200,10 @@ export const reportsGreen = colorPalette.green400;
export const reportsGray = colorPalette.gray400;
export const reportsLabel = pageText;
export const reportsInnerLabel = colorPalette.navy800;
+export const reportsNumberNegative = reportsRed;
+export const reportsNumberNeutral = pageText;
+export const reportsNumberPositive = reportsGreen;
+export const reportsChartFill = reportsNumberPositive;
export const noteTagBackground = colorPalette.purple800;
export const noteTagBackgroundHover = colorPalette.purple600;
diff --git a/upcoming-release-notes/6672.md b/upcoming-release-notes/6672.md
new file mode 100644
index 0000000000..4daff765ab
--- /dev/null
+++ b/upcoming-release-notes/6672.md
@@ -0,0 +1,6 @@
+---
+category: Enhancements
+authors: [matt-fidd]
+---
+
+Use consistent colours on the reports page