Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare new design tokens (v2.0.0) #17607

Merged
merged 1 commit into from
Mar 12, 2025
Merged

Conversation

jvaclavik
Copy link
Contributor

Description

Related Issue

Resolve

Screenshots:

@jvaclavik jvaclavik requested review from Nodonisko and a team as code owners March 12, 2025 12:54
Copy link

coderabbitai bot commented Mar 12, 2025

Walkthrough

The pull request applies a systematic update to color palette references across the codebase. Most instances of the old palette (palette) in imports and color assignments have been replaced with paletteV1, while new palette versions (paletteV2) and an additional color object (colorsV2) have been introduced. These changes affect the styling of various components such as radio cards, tooltips, QR codes, banners, switch elements, and charts. Adjustments include updates to background, border, stroke, and text colors, as well as the removal of previous gradient definitions in favor of solid color fills. Additionally, some components received modifications to variant properties related to theming. No public API or exported interface changes were made beyond these updates.

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
packages/suite/src/views/wallet/send/Options/BitcoinOptions/CoinControl/CoinControl.tsx (1)

221-221: Updated Token Usage: Aligning with New Design Tokens

The update of the iconColor prop from a legacy token (presumably theme.legacy.BG_GREEN) to theme.iconPrimaryDefault clearly reflects our move toward the new design tokens. This change enhances visual consistency for spendable UTXOs. Please verify whether the other UTXO lists (low anonymity and dust) intentionally continue using legacy tokens or if they also need to be updated for uniformity.

suite-native/atoms/src/Switch.tsx (1)

1-118: Consider documenting the palette versioning transition

The changes in this PR consistently migrate components to use paletteV1 instead of palette, indicating a transition to a versioned design token system. It would be helpful to include documentation about this transition, explaining when to use paletteV1 versus the new paletteV2, especially for developers who will be working on these components in the future.

packages/theme/src/colorsV2.ts (1)

1-724: Well-structured new color system implementation

This new file introduces a comprehensive color system with a clear organization:

  • Structured into light and dark themes
  • Uses semantic naming patterns (e.g., baseBorder*, baseContent*, baseFill*)
  • Properly imports from paletteV2
  • Includes various color categories (borders, content, fills, states, etc.)

The color tokens are named consistently following what appears to be a design system convention, making it easier for developers to find and use the appropriate colors.

One minor note: There's a comment on line 523 (//color-palette/dark/cool-grey/-25) that seems to be referencing the source of a color value. Consider standardizing these comments or removing them for consistency across the codebase.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e346ba7 and 59e79d5.

📒 Files selected for processing (14)
  • packages/components/src/components/RadioCard/RadioCard.tsx (2 hunks)
  • packages/components/src/components/Tooltip/TooltipArrow.tsx (2 hunks)
  • packages/components/src/components/Tooltip/TooltipBox.tsx (2 hunks)
  • packages/suite/src/components/suite/QrCode.tsx (3 hunks)
  • packages/suite/src/views/settings/SettingsGeneral/DesktopSuiteBanner.tsx (5 hunks)
  • packages/suite/src/views/view-only/ViewOnlyTooltip.tsx (2 hunks)
  • packages/suite/src/views/wallet/send/Options/BitcoinOptions/CoinControl/CoinControl.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/DCA/TradingDCALanding.tsx (4 hunks)
  • packages/theme/src/colors.ts (3 hunks)
  • packages/theme/src/colorsV2.ts (1 hunks)
  • packages/theme/src/index.ts (1 hunks)
  • packages/theme/src/paletteV1.ts (1 hunks)
  • packages/theme/src/paletteV2.ts (1 hunks)
  • suite-native/atoms/src/Switch.tsx (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (11)
  • GitHub Check: run-e2e-suite-desktop-tests (@group=wallet, trezor-user-env-unix bitcoin-regtest)
  • GitHub Check: run-e2e-suite-desktop-tests (@group=other, trezor-user-env-unix)
  • GitHub Check: run-e2e-suite-desktop-tests (@group=passphrase, trezor-user-env-unix)
  • GitHub Check: run-e2e-suite-desktop-tests (@group=settings, trezor-user-env-unix bitcoin-regtest)
  • GitHub Check: run-e2e-suite-desktop-tests (@group=device-management, trezor-user-env-unix)
  • GitHub Check: run-e2e-suite-desktop-tests (@group=suite, trezor-user-env-unix)
  • GitHub Check: EAS Update
  • GitHub Check: build-web
  • GitHub Check: Setup and Cache Dependencies
  • GitHub Check: prepare_android_test_app
  • GitHub Check: Analyze with CodeQL (javascript)
🔇 Additional comments (26)
packages/suite/src/views/settings/SettingsGeneral/DesktopSuiteBanner.tsx (5)

33-33: Theme token migration from legacy to new design system

The background color has been updated from legacy token BG_GREEN to the new semantic token baseFillSurfaceBrandDark, which better describes its purpose rather than just color. This change aligns with the v2.0.0 design tokens initiative.


55-55: Semantic naming improvement for text color

Good update from the legacy token TYPE_WHITE to the more descriptive semantic token baseContentPrimaryInverse, which indicates its purpose in the UI hierarchy rather than just the color value.


109-109: Added variant to IconButton for consistent styling

Adding the variant="tertiary" prop to the IconButton component ensures it follows the new design system's component variant standardization.


128-128: Button variant changed for better visual hierarchy

The Button's variant has been changed from tertiary to primary, making the call-to-action more prominent and aligned with standard design patterns where the main action uses the primary variant.


140-142: Added consistent variants to icon components

The Icon components for OS icons now include the variant="primary" prop, standardizing their appearance according to the new design system tokens and ensuring consistent styling across the application.

packages/theme/src/paletteV2.ts (1)

1-321: Well-structured new color palette system with comprehensive variations.

The new paletteV2 introduces a thoroughly designed color system with:

  • Consistent naming convention (light/dark + color + shade/alpha)
  • Comprehensive coverage of neutrals, cool grays, and various colors
  • Complete spectrum of shades (from 900 to 25)
  • Alpha variations for transparency needs
  • Global black/white alpha constants for overlay use cases

This palette structure will significantly improve design consistency across the application.

packages/suite/src/components/suite/QrCode.tsx (3)

4-4: Import updated to use explicit version namespace.

The import has been updated to use paletteV1 which is aligned with the project's transition to a versioned palette system.


18-18: Component styling updated to use explicit palette version.

The change from palette to paletteV1 maintains consistent behavior while adapting to the new versioned palette system.


30-30: QR code fg color updated to use versioned palette reference.

The change ensures the component keeps using the same color value through the new palette versioning system.

packages/theme/src/paletteV1.ts (1)

3-3: Palette export renamed to match versioning strategy.

The main palette object has been renamed from palette to paletteV1 to accommodate the new versioning strategy. The color values themselves remain unchanged, ensuring backward compatibility.

packages/theme/src/index.ts (1)

8-9: Updated palette exports to support versioning strategy.

The exports have been updated to:

  1. Replace the previous palette export with the explicit paletteV1 version
  2. Add the new paletteV2 export for the new design token system

This change enables a smooth transition between palette versions while allowing both to be available during migration.

packages/components/src/components/Tooltip/TooltipBox.tsx (2)

5-5: LGTM: Updated import to use paletteV1 instead of palette

This change is consistent with the new design token versioning approach introduced in this PR.


30-30: Updated background styling to use paletteV1

The component styling has been updated to reference the new versioned palette.

packages/suite/src/views/view-only/ViewOnlyTooltip.tsx (2)

4-4: LGTM: Updated import to use paletteV1 instead of palette

This change aligns with the new design token versioning strategy.


21-22: Updated color properties to use paletteV1

Both the border and background-color properties have been correctly updated to reference the new versioned palette.

packages/components/src/components/Tooltip/TooltipArrow.tsx (2)

3-3: LGTM: Updated import to use paletteV1 instead of palette

This change is part of the consistent migration to the new design token versioning.


12-13: Updated fill and stroke to use paletteV1

The tooltip arrow's color properties have been correctly updated to reference the new versioned palette.

suite-native/atoms/src/Switch.tsx (2)

12-12: LGTM: Updated import to use paletteV1 instead of palette

Consistent with the changes made in other components, ensuring the native components also use the versioned palette.


57-57: Updated backgroundColor to use paletteV1

The switch circle's background color has been correctly updated to use the new versioned palette.

packages/components/src/components/RadioCard/RadioCard.tsx (2)

5-5: Import updated to reference paletteV1

The import has been updated from palette to paletteV1, aligning with the PR's goal of transitioning to the new design token system.


74-74: Color reference updated to paletteV1

The Icon component's color property now references paletteV1.lightWhiteAlpha1000 instead of the previous palette.lightWhiteAlpha1000, maintaining the same visual appearance while using the updated token system.

packages/suite/src/views/wallet/trading/DCA/TradingDCALanding.tsx (2)

18-18: Import updated to reference paletteV1

The import has been updated from palette to paletteV1, consistent with the transition happening across the codebase.


34-34: Color references updated to paletteV1

All color references in the styled components and JSX elements have been consistently updated to use paletteV1 instead of palette. This ensures the component maintains its visual appearance while using the updated token system.

Also applies to: 58-58, 60-60, 91-91, 94-94, 98-98

packages/theme/src/colors.ts (3)

3-5: Updated imports for new color system

The imports have been updated to include colorsV2 and replace palette with paletteV1, setting up the foundation for the transition to the new token system.


33-168: Comprehensive update of color references

All color definitions in both light and dark themes have been methodically updated to reference paletteV1 instead of palette. This large-scale update ensures consistency across the theme system while maintaining the same visual appearance.

Also applies to: 199-334


169-169: Integration of colorsV2 into theme objects

The new color system from colorsV2 has been integrated into both light and dark theme objects using the spread operator. This approach allows for a gradual transition to the new color system while maintaining backward compatibility.

Also applies to: 335-335

Copy link

github-actions bot commented Mar 12, 2025

🚀 Expo preview is ready!

  • Project → trezor-suite-preview
  • Platforms → android, ios
  • Scheme → trezorsuitelite
  • Runtime Version → 26
  • More info

Learn more about 𝝠 Expo Github Action

@jvaclavik jvaclavik force-pushed the add-design-tokens-v2-2 branch from 59e79d5 to b8788b2 Compare March 12, 2025 13:06
Copy link
Member

@matejkriz matejkriz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes in the theme package and suite-native looks good, haven't check the rest...

@jvaclavik jvaclavik force-pushed the add-design-tokens-v2-2 branch from b8788b2 to a98433c Compare March 12, 2025 16:29
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
packages/theme/src/colorsV2.ts (2)

523-523: Consider using the variable format for consistency.

There's an inconsistency in how this value is referenced, with an inline comment explaining the actual palette value:

- baseFillSurfaceSunken: paletteV2.darkCoolGreyMinus25, //color-palette/dark/cool-grey/-25
+ baseFillSurfaceSunken: paletteV2.darkCoolGreyMinus25,

If darkCoolGreyMinus25 is a valid reference to paletteV2, the comment is unnecessary and should be removed. If it's not, consider ensuring this color is properly defined in the palette.


119-119: Check for typo in variable name.

There appears to be a potential typo in the variable name:

- baseFillElementGhost: paletteV2.globaltransparent,
+ baseFillElementGhost: paletteV2.globalTransparent,

Other global variables use camelCase (like globalWhiteAlpha1000), so globaltransparent should likely be globalTransparent for consistency.

packages/theme/src/colors.ts (1)

150-168: Consider documenting the deprecation timeline for non-valid tokens.

The code includes sections explicitly marked as "non-valid tokens (should be removed)". Consider adding a more specific deprecation timeline comment or TODO with a target version for removal to help track technical debt.

// non-valid tokens (should be removed)
+ // TODO: Remove these tokens in version X.X.X as they're replaced by the new design system

Also applies to: 316-334

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b8788b2 and a98433c.

📒 Files selected for processing (15)
  • packages/components/src/components/RadioCard/RadioCard.tsx (2 hunks)
  • packages/components/src/components/Tooltip/TooltipArrow.tsx (2 hunks)
  • packages/components/src/components/Tooltip/TooltipBox.tsx (2 hunks)
  • packages/suite/src/components/suite/QrCode.tsx (3 hunks)
  • packages/suite/src/components/suite/graph/TransactionsGraph/TransactionsGraph.tsx (4 hunks)
  • packages/suite/src/views/settings/SettingsGeneral/DesktopSuiteBanner.tsx (5 hunks)
  • packages/suite/src/views/view-only/ViewOnlyTooltip.tsx (2 hunks)
  • packages/suite/src/views/wallet/send/Options/BitcoinOptions/CoinControl/CoinControl.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/DCA/TradingDCALanding.tsx (4 hunks)
  • packages/theme/src/colors.ts (3 hunks)
  • packages/theme/src/colorsV2.ts (1 hunks)
  • packages/theme/src/index.ts (1 hunks)
  • packages/theme/src/paletteV1.ts (1 hunks)
  • packages/theme/src/paletteV2.ts (1 hunks)
  • suite-native/atoms/src/Switch.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (13)
  • suite-native/atoms/src/Switch.tsx
  • packages/suite/src/components/suite/QrCode.tsx
  • packages/suite/src/views/wallet/send/Options/BitcoinOptions/CoinControl/CoinControl.tsx
  • packages/suite/src/views/view-only/ViewOnlyTooltip.tsx
  • packages/theme/src/paletteV1.ts
  • packages/theme/src/paletteV2.ts
  • packages/suite/src/views/settings/SettingsGeneral/DesktopSuiteBanner.tsx
  • packages/components/src/components/RadioCard/RadioCard.tsx
  • packages/components/src/components/Tooltip/TooltipBox.tsx
  • packages/theme/src/index.ts
  • packages/components/src/components/Tooltip/TooltipArrow.tsx
  • packages/suite/src/views/wallet/trading/DCA/TradingDCALanding.tsx
  • packages/suite/src/components/suite/graph/TransactionsGraph/TransactionsGraph.tsx
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: run-e2e-suite-desktop-tests (@group=wallet, trezor-user-env-unix bitcoin-regtest)
  • GitHub Check: run-e2e-suite-desktop-tests (@group=passphrase, trezor-user-env-unix)
  • GitHub Check: EAS Update
  • GitHub Check: prepare_android_test_app
  • GitHub Check: Setup and Cache Dependencies
  • GitHub Check: build-web
  • GitHub Check: Analyze with CodeQL (javascript)
🔇 Additional comments (3)
packages/theme/src/colorsV2.ts (1)

1-724: Well-structured and comprehensive color token system.

This new file introduces a well-organized color token system with clear naming conventions following the pattern of "category + context + variant" (e.g., baseBorderBrand, baseContentPrimary, stateFillElementBrandBold). The structure seems to follow design system best practices with tokens organized for different UI contexts and states.

The comprehensive coverage of UI elements, states, and both light/dark themes demonstrates a thoughtful approach to design token organization.

packages/theme/src/colors.ts (2)

3-5: Clean migration from palette to paletteV1.

The import changes and integration of colorsV2 are well-structured. This approach allows for a gradual transition to the new color system while maintaining backward compatibility.


169-169: Good integration of new color tokens.

Adding the new colorsV2 values using the spread operator is a clean approach to integrate the new tokens alongside the existing ones. This strategy enables gradual adoption of the new design system while maintaining compatibility with existing components.

Also applies to: 335-335

@jvaclavik jvaclavik force-pushed the add-design-tokens-v2-2 branch from a98433c to cca9081 Compare March 12, 2025 17:33
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/theme/src/colorsV2.ts (2)

3-363: Well-structured color definitions for the light theme.
All key-value pairs appear consistent and logically named. This large object helps maintain clarity but also implies a high maintenance overhead.

Consider adding inline documentation for uncommon entries or clarifying alpha usage in a comment to guide future contributors.


364-724: Extensive color mappings for the dark theme.
The structure is parallel to light, which is good for consistency.

If feasible, think about generating these definitions in a DRY manner or via a build script. This can reduce repetition and the risk of manual errors while still preserving clarity in your design tokens.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a98433c and cca9081.

📒 Files selected for processing (15)
  • packages/components/src/components/RadioCard/RadioCard.tsx (2 hunks)
  • packages/components/src/components/Tooltip/TooltipArrow.tsx (2 hunks)
  • packages/components/src/components/Tooltip/TooltipBox.tsx (2 hunks)
  • packages/suite/src/components/suite/QrCode.tsx (3 hunks)
  • packages/suite/src/components/suite/graph/TransactionsGraph/TransactionsGraph.tsx (4 hunks)
  • packages/suite/src/views/settings/SettingsGeneral/DesktopSuiteBanner.tsx (5 hunks)
  • packages/suite/src/views/view-only/ViewOnlyTooltip.tsx (2 hunks)
  • packages/suite/src/views/wallet/send/Options/BitcoinOptions/CoinControl/CoinControl.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/DCA/TradingDCALanding.tsx (4 hunks)
  • packages/theme/src/colors.ts (3 hunks)
  • packages/theme/src/colorsV2.ts (1 hunks)
  • packages/theme/src/index.ts (1 hunks)
  • packages/theme/src/paletteV1.ts (1 hunks)
  • packages/theme/src/paletteV2.ts (1 hunks)
  • suite-native/atoms/src/Switch.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (13)
  • suite-native/atoms/src/Switch.tsx
  • packages/components/src/components/Tooltip/TooltipBox.tsx
  • packages/suite/src/components/suite/QrCode.tsx
  • packages/components/src/components/RadioCard/RadioCard.tsx
  • packages/components/src/components/Tooltip/TooltipArrow.tsx
  • packages/theme/src/paletteV1.ts
  • packages/suite/src/views/wallet/send/Options/BitcoinOptions/CoinControl/CoinControl.tsx
  • packages/suite/src/components/suite/graph/TransactionsGraph/TransactionsGraph.tsx
  • packages/theme/src/index.ts
  • packages/suite/src/views/view-only/ViewOnlyTooltip.tsx
  • packages/theme/src/paletteV2.ts
  • packages/suite/src/views/settings/SettingsGeneral/DesktopSuiteBanner.tsx
  • packages/suite/src/views/wallet/trading/DCA/TradingDCALanding.tsx
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: EAS Update
  • GitHub Check: prepare_android_test_app
  • GitHub Check: build-web
  • GitHub Check: Setup and Cache Dependencies
  • GitHub Check: Analyze with CodeQL (javascript)
🔇 Additional comments (6)
packages/theme/src/colorsV2.ts (1)

1-2: Acknowledge import statement for paletteV2.
No issues found here.

packages/theme/src/colors.ts (5)

3-5: New imports referencing colorsV2 and paletteV1.
Usage looks correct, aligning with the project’s shift toward updated design tokens.


33-178: Light theme definitions updated to use paletteV1.
All replacements and references appear consistent.


208-354: Dark theme definitions switched to paletteV1.
No immediate logical issues detected here.


355-355: Merging colorsV2.dark into the dark theme.

Similarly, ensure no property collisions with the local definitions in the dark theme. Consider reusing the above script—simply replace references to light with dark if you’d like to automate the check.


179-179:

❓ Verification inconclusive

Merging colorsV2.light into the existing light theme.

Confirm that none of the property keys introduced by colorsV2.light collide with properties you have defined in this file. If there are duplicates, the ones defined later will override the earlier ones, potentially causing unintended styling changes.


🏁 Script executed:

#!/bin/bash
# This script checks for potential key collisions between the local "light" object
# and the imported "colorsV2.light" object.

echo "Extracting 'light' object keys from colors.ts..."
rg --multiline --after-context 200 "const light = {" packages/theme/src/colors.ts \
  | rg '^[ ]*[a-zA-Z0-9]+' \
  | sed 's/[ \t]*\([^:]*\):.*/\1/' \
  | sed '/const\|transparent\|\/\/\|\.\.\./d' \
  | sort > /tmp/light_keys_colors_ts.txt

echo "Extracting 'light' object keys from colorsV2.ts..."
rg --multiline --after-context 300 "light: {" packages/theme/src/colorsV2.ts \
  | rg '^[ ]*[a-zA-Z0-9]+' \
  | sed 's/[ \t]*\([^:]*\):.*/\1/' \
  | sed '/light\|\/\/\|\.\.\./d' \
  | sort > /tmp/light_keys_colorsV2_ts.txt

echo "Checking for collisions..."
comm -12 /tmp/light_keys_colors_ts.txt /tmp/light_keys_colorsV2_ts.txt

Length of output: 1003


I've updated the collision-check script to fix the regex errors and avoid the missing comm command. Please run the revised script below to verify that none of the keys introduced by colorsV2.light collide with those defined locally. You can then manually inspect the output to ensure that any key collisions are intentional (i.e. the later keys overriding the earlier ones).

Revised collision detection script:

#!/bin/bash
# Updated script to check for key collisions with escaped curly braces and grep-based intersection

echo "Extracting 'light' object keys from colors.ts..."
rg --multiline --after-context 200 'const light = \{' packages/theme/src/colors.ts \
  | rg '^[ ]*[a-zA-Z0-9]+' \
  | sed 's/[ \t]*\([^:]*\):.*/\1/' \
  | sed '/const\|transparent\|\/\/\|\.\.\./d' \
  | sort > /tmp/light_keys_colors_ts.txt

echo "Extracting 'light' object keys from colorsV2.ts..."
rg --multiline --after-context 300 'light: \{' packages/theme/src/colorsV2.ts \
  | rg '^[ ]*[a-zA-Z0-9]+' \
  | sed 's/[ \t]*\([^:]*\):.*/\1/' \
  | sed '/light\|\/\/\|\.\.\./d' \
  | sort > /tmp/light_keys_colorsV2_ts.txt

echo "Checking for collisions using grep..."
grep -Fxf /tmp/light_keys_colorsV2_ts.txt /tmp/light_keys_colors_ts.txt

Please re-run this script and verify the results. If any collisions are reported, review whether the overriding behavior is intended.

@jvaclavik jvaclavik force-pushed the add-design-tokens-v2-2 branch from cca9081 to d38343f Compare March 12, 2025 17:41
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
packages/theme/src/colorsV2.ts (3)

180-191: Consider using palette variables for shadow values

While most of the color tokens reference palette variables, the shadow values (180-191) use hardcoded hex values. Consider moving these to the palette for consistency, maintainability, and to enable easier theme customization.


522-522: Use palette variable instead of hardcoded color

The dark theme is using a hardcoded hex value for baseFillSurfaceSticky. For consistency and maintainability, consider using a palette variable instead.

-    baseFillSurfaceSticky: '#1C1E20DB',
+    baseFillSurfaceSticky: paletteV2.darkCoolGreyAlpha850, // Create this in paletteV2 if needed

523-523: Remove code comment after standardization

There's a comment indicating the source path of the color. If this is a temporary note during development, consider removing it before finalizing the PR.

-    baseFillSurfaceSunken: paletteV2.darkCoolGreyMinus25, //color-palette/dark/cool-grey/-25
+    baseFillSurfaceSunken: paletteV2.darkCoolGreyMinus25,
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cca9081 and d38343f.

📒 Files selected for processing (16)
  • packages/components/src/components/RadioCard/RadioCard.tsx (2 hunks)
  • packages/components/src/components/Tooltip/TooltipArrow.tsx (2 hunks)
  • packages/components/src/components/Tooltip/TooltipBox.tsx (2 hunks)
  • packages/suite/src/components/suite/QrCode.tsx (3 hunks)
  • packages/suite/src/components/suite/graph/TransactionsGraph/TransactionsGraph.tsx (4 hunks)
  • packages/suite/src/views/settings/SettingsGeneral/DesktopSuiteBanner.tsx (5 hunks)
  • packages/suite/src/views/view-only/ViewOnlyTooltip.tsx (2 hunks)
  • packages/suite/src/views/wallet/send/Options/BitcoinOptions/CoinControl/CoinControl.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/DCA/TradingDCALanding.tsx (4 hunks)
  • packages/theme/src/colors.ts (3 hunks)
  • packages/theme/src/colorsV2.ts (1 hunks)
  • packages/theme/src/index.ts (1 hunks)
  • packages/theme/src/paletteV1.ts (1 hunks)
  • packages/theme/src/paletteV2.ts (1 hunks)
  • submodules/trezor-common (1 hunks)
  • suite-native/atoms/src/Switch.tsx (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • submodules/trezor-common
🚧 Files skipped from review as they are similar to previous changes (13)
  • packages/suite/src/views/wallet/send/Options/BitcoinOptions/CoinControl/CoinControl.tsx
  • suite-native/atoms/src/Switch.tsx
  • packages/theme/src/paletteV2.ts
  • packages/suite/src/views/view-only/ViewOnlyTooltip.tsx
  • packages/components/src/components/RadioCard/RadioCard.tsx
  • packages/theme/src/paletteV1.ts
  • packages/suite/src/components/suite/QrCode.tsx
  • packages/theme/src/index.ts
  • packages/components/src/components/Tooltip/TooltipArrow.tsx
  • packages/suite/src/components/suite/graph/TransactionsGraph/TransactionsGraph.tsx
  • packages/components/src/components/Tooltip/TooltipBox.tsx
  • packages/suite/src/views/settings/SettingsGeneral/DesktopSuiteBanner.tsx
  • packages/suite/src/views/wallet/trading/DCA/TradingDCALanding.tsx
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: Analyze with CodeQL (javascript)
  • GitHub Check: Setup and Cache Dependencies
  • GitHub Check: prepare_android_test_app
  • GitHub Check: EAS Update
  • GitHub Check: build-web
🔇 Additional comments (10)
packages/theme/src/colorsV2.ts (3)

1-3: New color system structure looks good

This new file establishes the foundation for version 2 of the design tokens by importing and using the new paletteV2. The naming structure is clear and follows a consistent pattern.


4-178: Light theme tokens follow a clear, systematic naming convention

The light theme color tokens follow a strong semantic naming convention that clearly identifies their:

  • Context (base, illustration, state)
  • Element type (border, content, fill)
  • Variant (brand, neutral, warning, etc.)
  • State/intensity (softer, bold, contrast, etc.)

This naming approach will make it easier for developers to find the right token for their use case and helps maintain consistency across the UI.


364-723: Dark theme tokens maintain symmetry with light theme

The dark theme color tokens mirror the light theme structure, providing a consistent API across themes. This makes it easy for components to switch between themes without changing their token references.

packages/theme/src/colors.ts (7)

3-5: Good approach to version transition with imports

Importing both colorsV2 and paletteV1 allows for a smooth transition between versions while maintaining backward compatibility. The import names clearly indicate the versioning strategy.


33-166: Consistent migration from palette to paletteV1

All references to the previous palette have been systematically updated to use paletteV1, maintaining the same color token structure while preparing for the new version. This approach allows for a gradual transition without breaking existing components.


169-178: Consider removing non-valid tokens in a future update

The code contains a section labeled "non-valid tokens (should be removed)" which has been updated to use paletteV1 but is still marked for removal. Consider planning for their removal in a future update to clean up the API.

Is there a deprecation plan for these non-valid tokens? If these are used in the codebase, you might want to add deprecation warnings before fully removing them.


179-179: Good integration of new color system

Using the spread operator to include all colorsV2.light values into the light theme ensures that all new tokens are available while maintaining backward compatibility with existing tokens. This pattern appears again with the dark theme.


209-343: Dark theme consistently updated to paletteV1

The dark theme has been thoroughly updated to use paletteV1 references, maintaining consistency with the light theme implementation. This ensures both themes reference the same version of the palette.


346-355: Same comment about non-valid tokens in dark theme

As with the light theme, the dark theme contains non-valid tokens that have been updated to use paletteV1 but are still marked for removal. Consider creating a deprecation plan for these tokens.


356-356: Consistent approach to integrating colorsV2 in dark theme

Using the spread operator to include colorsV2.dark maintains symmetry with how the light theme was handled, ensuring a consistent approach across the theming system.

@jvaclavik jvaclavik force-pushed the add-design-tokens-v2-2 branch 2 times, most recently from 200c80e to 0ff20ca Compare March 12, 2025 17:54
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 1

🧹 Nitpick comments (2)
packages/theme/src/colorsV2.ts (2)

364-724: Reduce repetition by leveraging a shared base configuration.

Most values in the dark theme mirror the light theme, with minor variations. Consider extracting common tokens into a shared base and programmatically adjusting alpha or brightness for light vs. dark, to avoid duplication. This approach minimizes manual updates and possible inconsistencies.


3-363:

❓ Verification inconclusive

Consider verifying references and factoring out repeated definitions.

The light theme object references a large number of paletteV2 tokens. While this may be acceptable for thorough design token coverage, such duplication can hamper maintainability and increase the risk of typos. Consolidating or auto-generating these definitions could simplify upkeep.

Below is a script to confirm all paletteV2. references here actually exist in the paletteV2 export:


🏁 Script executed:

#!/bin/bash
# Searches for usage of paletteV2.<token> within colorsV2.ts 
rg -oN 'paletteV2\.\w+' packages/theme/src/colorsV2.ts | sort -u

Length of output: 4677


Suggestion: Factor Out Duplicate paletteV2 References

The script confirms that all paletteV2 token references in colorsV2.ts (lines 3–363) are valid. However, the sheer volume of repeated references can make future maintenance error-prone. Consider refactoring by consolidating common tokens or auto-generating these definitions to simplify upkeep and reduce the risk of typos.

🛑 Comments failed to post (1)
packages/theme/src/colors.ts (1)

346-356: 🛠️ Refactor suggestion

Remove or finalize these non-valid tokens.

The code marks these tokens as deprecated or invalid. Keeping them around may cause confusion. Consider removing them, or denote them with a clear “deprecated” tag until fully removed.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (6)
packages/theme/src/colorsV2.ts (4)

119-119: Consider using constant for transparent value

I notice globaltransparent is being used. Consider using a TypeScript constant or defining this value in a more type-safe way (e.g., 'transparent' or specific rgba value) to ensure consistency.

Also applies to: 479-479


180-191: Shadow values are hardcoded

While most color values reference the palette, shadow values are hardcoded hex strings. Consider defining these in the palette or in a dedicated shadows object for better maintainability.

- shadowAmbientAction: '#00284705',
- shadowAmbientActionHover: '#0028470A',
+ shadowAmbientAction: paletteV2.shadows.ambientAction,
+ shadowAmbientActionHover: paletteV2.shadows.ambientActionHover,

Also applies to: 540-551


522-523: Inconsistent value formats in dark theme

There's a hardcoded hex value for baseFillSurfaceSticky and an inline comment for baseFillSurfaceSunken. This is inconsistent with the rest of the file where palette references are used.

- baseFillSurfaceSticky: '#1C1E20DB',
- baseFillSurfaceSunken: paletteV2.darkCoolGreyMinus25, //color-palette/dark/cool-grey/-25
+ baseFillSurfaceSticky: paletteV2.darkCoolGreyCustomAlpha,
+ baseFillSurfaceSunken: paletteV2.darkCoolGreyMinus25,

Consider adding these values to the palette if they are special cases.


1-724: Consider breaking down this large file

While well-organized, this file is quite large (700+ lines). Consider splitting it into smaller modules (perhaps by theme or by component category) to improve maintainability.

packages/theme/src/colors.ts (2)

168-175: Consider removing non-valid tokens

The file contains a comment indicating that some tokens "should be removed" but they are still present in the code. Consider creating a follow-up task to remove these non-valid tokens in a future release, since they might be referenced in other parts of the codebase.


1-358: Documentation for color system versioning

While the code changes are systematic and well-structured, it would be beneficial to include documentation about the versioning strategy for the color system, explaining the relationship between paletteV1 and colorsV2, and providing migration guidance for developers.

Consider adding a comment at the top of the file explaining:

  • The versioning strategy
  • How to migrate from palette to paletteV1
  • How to use colorsV2 alongside or instead of the existing colors
  • Deprecation timeline for non-valid tokens
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 200c80e and 0ff20ca.

📒 Files selected for processing (16)
  • packages/components/src/components/RadioCard/RadioCard.tsx (2 hunks)
  • packages/components/src/components/Tooltip/TooltipArrow.tsx (2 hunks)
  • packages/components/src/components/Tooltip/TooltipBox.tsx (2 hunks)
  • packages/suite/src/components/suite/QrCode.tsx (3 hunks)
  • packages/suite/src/components/suite/graph/TransactionsGraph/TransactionsGraph.tsx (4 hunks)
  • packages/suite/src/views/settings/SettingsGeneral/DesktopSuiteBanner.tsx (5 hunks)
  • packages/suite/src/views/view-only/ViewOnlyTooltip.tsx (2 hunks)
  • packages/suite/src/views/wallet/send/Options/BitcoinOptions/CoinControl/CoinControl.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/DCA/TradingDCALanding.tsx (4 hunks)
  • packages/theme/src/colors.ts (3 hunks)
  • packages/theme/src/colorsV2.ts (1 hunks)
  • packages/theme/src/index.ts (1 hunks)
  • packages/theme/src/paletteV1.ts (1 hunks)
  • packages/theme/src/paletteV2.ts (1 hunks)
  • submodules/trezor-common (1 hunks)
  • suite-native/atoms/src/Switch.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (14)
  • packages/theme/src/paletteV1.ts
  • packages/suite/src/views/wallet/send/Options/BitcoinOptions/CoinControl/CoinControl.tsx
  • packages/theme/src/index.ts
  • packages/theme/src/paletteV2.ts
  • packages/components/src/components/Tooltip/TooltipBox.tsx
  • submodules/trezor-common
  • packages/components/src/components/Tooltip/TooltipArrow.tsx
  • packages/components/src/components/RadioCard/RadioCard.tsx
  • packages/suite/src/components/suite/graph/TransactionsGraph/TransactionsGraph.tsx
  • suite-native/atoms/src/Switch.tsx
  • packages/suite/src/views/settings/SettingsGeneral/DesktopSuiteBanner.tsx
  • packages/suite/src/views/view-only/ViewOnlyTooltip.tsx
  • packages/suite/src/components/suite/QrCode.tsx
  • packages/suite/src/views/wallet/trading/DCA/TradingDCALanding.tsx
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: Unit Tests
  • GitHub Check: Releases revision Checks
  • GitHub Check: Linting and formatting
  • GitHub Check: Build libs for publishing
  • GitHub Check: Type Checking
  • GitHub Check: build-web
  • GitHub Check: Analyze with CodeQL (javascript)
  • GitHub Check: prepare_android_test_app
  • GitHub Check: EAS Update
🔇 Additional comments (7)
packages/theme/src/colorsV2.ts (2)

1-3: Well-structured color token system

The new color token system follows a clear and consistent naming convention that makes it easy to understand the purpose of each token. The hierarchical naming pattern (purpose/type/context/semantic/variant/state) provides excellent organization.


4-363: Comprehensive theming system supports accessibility

The light and dark theme definitions are comprehensive and mirror each other structurally, which is excellent for maintaining both themes. This approach ensures a consistent experience across themes while supporting accessibility needs.

Also applies to: 364-723

packages/theme/src/colors.ts (5)

3-5: Update to versioned palette imports

The changes introduce paletteV1 import to replace palette, and add a new colorsV2 import, which aligns with the PR title's mention of "new design tokens (v2.0.0)". This is a good approach for versioning design tokens while maintaining backward compatibility.


33-178: Systematic refactoring of light theme color definitions

All light theme color definitions have been updated to reference paletteV1 instead of palette. This comprehensive refactoring ensures consistency across all color tokens in the light theme.


209-355: Systematic refactoring of dark theme color definitions

All dark theme color definitions have been consistently updated to reference paletteV1 instead of palette, ensuring the new version naming convention is applied throughout the dark theme.


356-356: Integration of V2 dark theme colors

Similar to the light theme, dark theme colors are also being extended with colorsV2.dark properties. This ensures consistent application of the new color system across both themes.


179-179:

✅ Verification successful

Integration of new V2 color system

The addition of ...colorsV2.light suggests that you're introducing a new version of the color system alongside the existing one. This approach allows for a gradual migration to the new color system.

Note that any overlapping keys in colorsV2.light will overwrite the same-named keys defined above.


🏁 Script executed:

#!/bin/bash
# Check for any potential key conflicts between existing colors and colorsV2
echo "Searching for colorsV2 definitions..."
cat packages/theme/src/colorsV2.ts

Length of output: 48829


Verified Integration of New V2 Color System

The spread operator (...colorsV2.light) in packages/theme/src/colors.ts correctly integrates the new V2 light theme colors. I verified that the colorsV2.ts file contains a comprehensive set of color definitions for the light (and dark) themes, and the design intentionally allows any overlapping keys to be overridden by the V2 values. This gradual migration approach is sound, provided that the override behavior is consistent with our design specifications.

  • File: packages/theme/src/colors.ts at line 179 uses ...colorsV2.light to merge new light theme colors.
  • Verification: The colorsV2.ts file includes the expected keys for the light color scheme, confirming the intended override mechanism.

@jvaclavik jvaclavik force-pushed the add-design-tokens-v2-2 branch from 0ff20ca to d28486b Compare March 12, 2025 18:37
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/theme/src/colors.ts (1)

169-177: Consider removing non-valid tokens in a future update

The comments indicate these tokens "should be removed", yet they're still present in both themes. While maintaining them during the transition is understandable for backward compatibility, consider creating a follow-up task to remove these deprecated tokens once the migration to V2 is complete.

Also applies to: 346-354

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0ff20ca and d28486b.

📒 Files selected for processing (15)
  • packages/components/src/components/RadioCard/RadioCard.tsx (2 hunks)
  • packages/components/src/components/Tooltip/TooltipArrow.tsx (2 hunks)
  • packages/components/src/components/Tooltip/TooltipBox.tsx (2 hunks)
  • packages/suite/src/components/suite/QrCode.tsx (3 hunks)
  • packages/suite/src/components/suite/graph/TransactionsGraph/TransactionsGraph.tsx (4 hunks)
  • packages/suite/src/views/settings/SettingsGeneral/DesktopSuiteBanner.tsx (5 hunks)
  • packages/suite/src/views/view-only/ViewOnlyTooltip.tsx (2 hunks)
  • packages/suite/src/views/wallet/send/Options/BitcoinOptions/CoinControl/CoinControl.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/DCA/TradingDCALanding.tsx (4 hunks)
  • packages/theme/src/colors.ts (3 hunks)
  • packages/theme/src/colorsV2.ts (1 hunks)
  • packages/theme/src/index.ts (1 hunks)
  • packages/theme/src/paletteV1.ts (1 hunks)
  • packages/theme/src/paletteV2.ts (1 hunks)
  • suite-native/atoms/src/Switch.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (14)
  • packages/components/src/components/Tooltip/TooltipBox.tsx
  • packages/suite/src/views/wallet/send/Options/BitcoinOptions/CoinControl/CoinControl.tsx
  • packages/theme/src/paletteV1.ts
  • suite-native/atoms/src/Switch.tsx
  • packages/suite/src/components/suite/QrCode.tsx
  • packages/suite/src/views/view-only/ViewOnlyTooltip.tsx
  • packages/components/src/components/Tooltip/TooltipArrow.tsx
  • packages/theme/src/index.ts
  • packages/theme/src/colorsV2.ts
  • packages/suite/src/components/suite/graph/TransactionsGraph/TransactionsGraph.tsx
  • packages/suite/src/views/settings/SettingsGeneral/DesktopSuiteBanner.tsx
  • packages/theme/src/paletteV2.ts
  • packages/components/src/components/RadioCard/RadioCard.tsx
  • packages/suite/src/views/wallet/trading/DCA/TradingDCALanding.tsx
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: EAS Update
  • GitHub Check: prepare_android_test_app
  • GitHub Check: Setup and Cache Dependencies
  • GitHub Check: Analyze with CodeQL (javascript)
  • GitHub Check: build-web
🔇 Additional comments (5)
packages/theme/src/colors.ts (5)

3-5: Good change: Import structure has been updated for proper versioning

The imports have been updated to clearly indicate versioned dependencies. Replacing palette with paletteV1 and adding colorsV2 shows a thoughtful approach to managing the transition between design token versions.


32-178: Systematic update of light theme color references to use versioned palette

All color references in the light theme have been consistently updated from palette.X to paletteV1.X. This systematic approach ensures backward compatibility while preparing for the new version.


179-179: Well-implemented addition of V2 colors to light theme

The spread of colorsV2.light into the light theme object is a good approach for implementing the new design tokens. This allows both token versions to coexist during the transition period.


209-355: Systematic update of dark theme color references to use versioned palette

All color references in the dark theme have been consistently updated from palette.X to paletteV1.X, mirroring the changes in the light theme. This consistency is important for maintaining theme parity.


356-356: Well-implemented addition of V2 colors to dark theme

The spread of colorsV2.dark into the dark theme object matches the approach used for the light theme, ensuring consistency across themes.

@jvaclavik jvaclavik merged commit 7d5e3bc into develop Mar 12, 2025
32 checks passed
@jvaclavik jvaclavik deleted the add-design-tokens-v2-2 branch March 12, 2025 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🤝 Needs QA
Development

Successfully merging this pull request may close these issues.

2 participants