From 5058bd6ec2306d3337e4524bfd0c6872e05378af Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 21 Jan 2025 16:24:42 +0100 Subject: [PATCH 1/8] Use color token throughout app --- desktop/packages/mullvad-vpn/src/config.json | 32 ----------------- .../src/renderer/components/AccountStyles.tsx | 8 ++--- .../renderer/components/ApiAccessMethods.tsx | 9 +++-- .../src/renderer/components/AppButton.tsx | 24 ++++++------- .../src/renderer/components/ChevronButton.tsx | 6 ++-- .../renderer/components/ClipboardLabel.tsx | 10 +++--- .../src/renderer/components/ContextMenu.tsx | 10 +++--- .../renderer/components/CustomDnsSettings.tsx | 8 ++--- .../components/CustomDnsSettingsStyles.tsx | 8 ++--- .../renderer/components/DeviceRevokedView.tsx | 8 ++--- .../src/renderer/components/ErrorView.tsx | 4 +-- .../components/ExpiredAccountAddTime.tsx | 7 ++-- .../ExpiredAccountErrorViewStyles.tsx | 12 +++---- .../src/renderer/components/Filter.tsx | 18 +++++----- .../src/renderer/components/InfoButton.tsx | 6 ++-- .../src/renderer/components/Launch.tsx | 8 ++--- .../src/renderer/components/LoginStyles.tsx | 34 +++++++++---------- .../src/renderer/components/Modal.tsx | 16 ++++----- .../components/NotificationBanner.tsx | 20 +++++------ .../src/renderer/components/PageSlider.tsx | 18 +++++----- .../components/ProblemReportStyles.tsx | 12 +++---- .../components/RedeemVoucherStyles.tsx | 16 ++++----- .../components/RelayStatusIndicator.tsx | 8 ++--- .../src/renderer/components/SearchBar.tsx | 26 +++++++------- .../src/renderer/components/SecuredLabel.tsx | 18 +++++----- .../renderer/components/SettingsImport.tsx | 6 ++-- .../components/SettingsTextImport.tsx | 4 +-- .../src/renderer/components/SmallButton.tsx | 16 ++++----- .../SplitTunnelingSettingsStyles.tsx | 7 ++-- .../src/renderer/components/Switch.tsx | 8 ++--- .../renderer/components/TooManyDevices.tsx | 16 ++++----- .../src/renderer/components/YellowLabel.tsx | 6 ++-- .../src/renderer/components/cell/Input.tsx | 14 ++++---- .../src/renderer/components/cell/Row.tsx | 4 +-- .../src/renderer/components/cell/Selector.tsx | 19 +++++------ .../components/cell/SettingsGroup.tsx | 4 +-- .../components/cell/SettingsRadioGroup.tsx | 8 ++--- .../renderer/components/cell/SettingsRow.tsx | 16 ++++----- .../components/cell/SettingsSelect.tsx | 18 +++++----- .../components/cell/SettingsTextInput.tsx | 6 ++-- .../renderer/components/cell/SideButton.tsx | 4 +-- .../main-view/ConnectionDetails.tsx | 8 ++--- .../main-view/ConnectionPanelChevron.tsx | 6 ++-- .../components/main-view/ConnectionStatus.tsx | 10 +++--- .../main-view/FeatureIndicators.tsx | 15 ++++---- .../components/main-view/Hostname.tsx | 4 +-- .../components/main-view/Location.tsx | 4 +-- .../select-location/CustomListDialogs.tsx | 6 ++-- .../select-location/CustomLists.tsx | 24 ++++++------- .../select-location/LocationRowStyles.tsx | 20 +++++------ .../components/select-location/ScopeBar.tsx | 10 +++--- .../select-location/SelectLocation.tsx | 11 +++--- .../select-location/SelectLocationStyles.tsx | 8 ++--- .../select-location/SpecialLocationList.tsx | 6 ++-- .../state-dependent/custom-bridge.spec.ts | 12 +++---- .../state-dependent/obfuscation.spec.ts | 18 +++++----- .../mocked/expired-account-error-view.spec.ts | 6 ++-- .../test/e2e/mocked/notifications.spec.ts | 4 +-- .../test/e2e/mocked/select-location.spec.ts | 10 +++--- .../test/e2e/shared/tunnel-state.ts | 14 ++++---- 60 files changed, 333 insertions(+), 365 deletions(-) diff --git a/desktop/packages/mullvad-vpn/src/config.json b/desktop/packages/mullvad-vpn/src/config.json index a77c47de4501..a603139ba953 100644 --- a/desktop/packages/mullvad-vpn/src/config.json +++ b/desktop/packages/mullvad-vpn/src/config.json @@ -6,38 +6,6 @@ "privacyGuide": "https://mullvad.net/help/first-steps-towards-online-privacy/", "download": "https://mullvad.net/download/vpn/" }, - "colors": { - "darkerBlue": "rgba(25, 38, 56, 0.95)", - "darkBlue": "rgb(25, 46, 69)", - "blue": "rgb(41, 77, 115)", - "darkGreen": "rgb(32, 84, 37)", - "green": "rgb(68, 173, 77)", - "red": "rgb(227, 64, 57)", - "darkYellow": "rgb(142, 78, 19)", - "yellow": "rgb(255, 213, 36)", - "black": "rgb(0, 0, 0)", - "white": "rgb(255, 255, 255)", - "white90": "rgba(255, 255, 255, 0.9)", - "white80": "rgba(255, 255, 255, 0.8)", - "white60": "rgba(255, 255, 255, 0.6)", - "white50": "rgba(255, 255, 255, 0.5)", - "white40": "rgba(255, 255, 255, 0.4)", - "white20": "rgba(255, 255, 255, 0.2)", - "white10": "rgba(255, 255, 255, 0.1)", - "blue10": "rgba(41, 77, 115, 0.1)", - "blue20": "rgba(41, 77, 115, 0.2)", - "blue40": "rgba(41, 77, 115, 0.4)", - "blue50": "rgba(41, 77, 115, 0.5)", - "blue60": "rgba(41, 77, 115, 0.6)", - "blue80": "rgba(41, 77, 115, 0.8)", - "red95": "rgba(227, 64, 57, 0.95)", - "red80": "rgba(227, 64, 57, 0.8)", - "red60": "rgba(227, 64, 57, 0.6)", - "red40": "rgba(227, 64, 57, 0.4)", - "red45": "rgba(227, 64, 57, 0.45)", - "green90": "rgba(68, 173, 77, 0.9)", - "green40": "rgba(68, 173, 77, 0.4)" - }, "strings": { "wireguard": "WireGuard", "openvpn": "OpenVPN", diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/AccountStyles.tsx b/desktop/packages/mullvad-vpn/src/renderer/components/AccountStyles.tsx index 228dd179dc93..155fb0465dea 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/components/AccountStyles.tsx +++ b/desktop/packages/mullvad-vpn/src/renderer/components/AccountStyles.tsx @@ -1,6 +1,6 @@ import styled from 'styled-components'; -import { colors } from '../../config.json'; +import { Colors } from '../lib/foundations'; import { measurements, normalText, tinyText } from './common-styles'; export const AccountContainer = styled.div({ @@ -28,12 +28,12 @@ const AccountRowText = styled.span({ export const AccountRowLabel = styled(AccountRowText)(tinyText, { lineHeight: '20px', marginBottom: '5px', - color: colors.white60, + color: Colors.white60, }); export const AccountRowValue = styled(AccountRowText)(normalText, { fontWeight: 600, - color: colors.white, + color: Colors.white, }); export const DeviceRowValue = styled(AccountRowValue)({ @@ -41,7 +41,7 @@ export const DeviceRowValue = styled(AccountRowValue)({ }); export const AccountOutOfTime = styled(AccountRowValue)({ - color: colors.red, + color: Colors.red, }); export const StyledDeviceNameRow = styled.div({ diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/ApiAccessMethods.tsx b/desktop/packages/mullvad-vpn/src/renderer/components/ApiAccessMethods.tsx index e11eec5fad03..cdfb906ab42f 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/components/ApiAccessMethods.tsx +++ b/desktop/packages/mullvad-vpn/src/renderer/components/ApiAccessMethods.tsx @@ -2,13 +2,12 @@ import { useCallback, useMemo } from 'react'; import { sprintf } from 'sprintf-js'; import styled from 'styled-components'; -import { colors } from '../../config.json'; import { AccessMethodSetting } from '../../shared/daemon-rpc-types'; import { messages } from '../../shared/gettext'; import { useAppContext } from '../context'; import { useApiAccessMethodTest } from '../lib/api-access-methods'; import { Container, Flex } from '../lib/components'; -import { Spacings } from '../lib/foundations'; +import { Colors, Spacings } from '../lib/foundations'; import { useHistory } from '../lib/history'; import { generateRoutePath } from '../lib/routeHelpers'; import { RoutePath } from '../lib/routes'; @@ -50,7 +49,7 @@ const StyledTestResultCircle = styled.div<{ $result: boolean }>((props) => ({ width: '10px', height: '10px', borderRadius: '50%', - backgroundColor: props.$result ? colors.green : colors.red, + backgroundColor: props.$result ? Colors.green : Colors.red, marginRight: Spacings.spacing2, })); @@ -300,8 +299,8 @@ function ApiAccessMethod(props: ApiAccessMethodProps) { diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/AppButton.tsx b/desktop/packages/mullvad-vpn/src/renderer/components/AppButton.tsx index f82b997cc4ec..26ddf6a21720 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/components/AppButton.tsx +++ b/desktop/packages/mullvad-vpn/src/renderer/components/AppButton.tsx @@ -1,8 +1,8 @@ import React, { useCallback, useContext, useMemo, useState } from 'react'; import styled from 'styled-components'; -import { colors } from '../../config.json'; import log from '../../shared/logging'; +import { Colors } from '../lib/foundations'; import { useMounted } from '../lib/utility-hooks'; import { StyledButtonContent, @@ -32,7 +32,7 @@ interface IIconProps { } export function Icon(props: IIconProps) { - return ; + return ; } export interface IProps extends React.HTMLAttributes { @@ -157,37 +157,37 @@ export function BlockingButton(props: IBlockingProps) { } export const RedButton = styled(BaseButton)({ - backgroundColor: colors.red, + backgroundColor: Colors.red, '&&:not(:disabled):hover': { - backgroundColor: colors.red95, + backgroundColor: Colors.red95, }, }); export const GreenButton = styled(BaseButton)({ - backgroundColor: colors.green, + backgroundColor: Colors.green, '&&:not(:disabled):hover': { - backgroundColor: colors.green90, + backgroundColor: Colors.green90, }, }); export const BlueButton = styled(BaseButton)({ - backgroundColor: colors.blue80, + backgroundColor: Colors.blue80, '&&:not(:disabled):hover': { - backgroundColor: colors.blue60, + backgroundColor: Colors.blue60, }, }); export const TransparentButton = styled(BaseButton)(transparentButton, { - backgroundColor: colors.white20, + backgroundColor: Colors.white20, '&&:not(:disabled):hover': { - backgroundColor: colors.white40, + backgroundColor: Colors.white40, }, }); export const RedTransparentButton = styled(BaseButton)(transparentButton, { - backgroundColor: colors.red60, + backgroundColor: Colors.red60, '&&:not(:disabled):hover': { - backgroundColor: colors.red80, + backgroundColor: Colors.red80, }, }); diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/ChevronButton.tsx b/desktop/packages/mullvad-vpn/src/renderer/components/ChevronButton.tsx index 6e16fdf6dbd4..c0ec34a592ac 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/components/ChevronButton.tsx +++ b/desktop/packages/mullvad-vpn/src/renderer/components/ChevronButton.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import styled from 'styled-components'; -import { colors } from '../../config.json'; +import { Colors } from '../lib/foundations'; import { Icon } from './cell/Label'; interface IProps extends React.HTMLAttributes { @@ -25,8 +25,8 @@ export default function ChevronButton(props: IProps) { return (