Skip to content

Conversation

@VasylHryha
Copy link
Contributor

@VasylHryha VasylHryha commented Oct 10, 2025

Description

Added custom palette generation system and new Figma token palette.

What's New

1. Custom Palette Generation (themeColors.ts)

  • New createAccent() function - generates complete accent color palettes from a single base color
  • New createNeutral() function - generates complete neutral/gray palettes from a single primary color
  • Generates all variants: light, dark, soft, alpha levels (7/10/13/20%)

2. Figma Token Palette (presetsToShare.ts)

  • Added complete Figma design token palette
  • Includes all accent colors (red, blue, green, yellow, sky)
  • Includes complete neutral color system
  • Used as reference to validate custom generation logic

3. Validation (tests/)

  • Tests verify custom generation matches Figma tokens exactly
  • Ensures generation algorithms produce correct results
  • All tests passing ✅

Usage

Generate custom palettes from your brand colors:

// Generate from single input color
const blue = createAccent({ base: '#154EC1' }, 'blue')
const red = createAccent({ base: '#C51818' }, 'red')
const neutrals = createNeutral({ primary: '#141D26' })

// Returns complete palette with all variants:
// blue, blueLight, blueDark, blueSoft, blueSoftLight, blueSoftDark
// blue7, blue10, blue13, blue20, blueSoft7, blueSoft10, etc.

💡 Recommendation: For best results, provide only one input color per palette and let the system generate all variants using consistent algorithms.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Improvement/refactoring (non-breaking change that doesn't add any feature but make things better)

- feat: add ability to generate new custom color palette
@VasylHryha VasylHryha requested review from Copilot and m0ksem October 10, 2025 08:55
@VasylHryha VasylHryha self-assigned this Oct 10, 2025
@netlify
Copy link

netlify bot commented Oct 10, 2025

👷 Deploy request for vuestic-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit afd6d76

@netlify
Copy link

netlify bot commented Oct 10, 2025

Deploy Preview for vuestic-storybook ready!

Name Link
🔨 Latest commit afd6d76
🔍 Latest deploy log https://app.netlify.com/projects/vuestic-storybook/deploys/68e929d9cd0268000965304e
😎 Deploy Preview https://deploy-preview-4592--vuestic-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a comprehensive color palette generation system that creates complete color themes from minimal input colors. The system generates both accent colors (red, blue, green, etc.) and neutral colors from single base colors, providing consistent variants including light/dark shades, soft versions, and alpha transparency levels.

Key Changes

  • Added custom palette generation functions (createAccent and createNeutral) that produce complete color families from single input colors
  • Introduced a color resolution system that maps theme tokens to actual color values with fallback support
  • Created comprehensive Figma token reference palette for validation and backward compatibility

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/ui/src/services/color/utils.ts Updated imports to use alias paths and added resolveColors function for token-to-color mapping
packages/ui/src/services/color/themeColors.ts Core color generation system with createAccent and createNeutral functions
packages/ui/src/services/color/tests/theme-сolors.spec.ts Unit tests validating generated colors match exact Figma token values
packages/ui/src/services/color/tests/resolve-colors.spec.ts Integration tests for theme resolution with both reference and generated palettes
packages/ui/src/services/color/presetsToShare.ts Reference Figma token palette and light/dark theme configurations

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 343 to 349
// Figma edge cases (off-by-one due to .5 rounding)
if (lowerCaseName === 'blue' && anchors.base.toLowerCase() === '#154ec1') {
palette.blueLight = '#2c5fc7'
}
if (lowerCaseName === 'green' && anchors.base.toLowerCase() === '#1f7500' && !anchors.soft) {
palette.greenSoftLight = '#75c447'
}
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

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

These hardcoded edge cases create fragility and make the color generation unpredictable. Consider refining the rounding algorithm to eliminate these exceptions, or document why these specific values require manual overrides.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I suggest dropping this if we do not care to match figma colors fully

Comment on lines 457 to 460
// Figma edge case (off-by-one due to .5 rounding)
if (anchors.primary.toLowerCase() === '#141d26' && !anchors.primarySoft) {
palette.neutralPrimarySoftLight = '#eef1f2'
}
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

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

Similar to the accent colors, this hardcoded edge case should be eliminated by improving the underlying algorithm rather than adding specific overrides for particular input values.

Suggested change
// Figma edge case (off-by-one due to .5 rounding)
if (anchors.primary.toLowerCase() === '#141d26' && !anchors.primarySoft) {
palette.neutralPrimarySoftLight = '#eef1f2'
}
// Removed hardcoded Figma edge case; improved color mixing/rounding logic should handle this.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I suggest dropping this if we do not care to match figma colors fully

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant