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

Add support for color mode defined by color name prefix #218 #235

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fedulvtubudul
Copy link

No description provided.

let lightPrefix = colorParams?.lightModePrefix
let darkPrefix = colorParams?.darkModePrefix
let lightSuffix = colorParams?.lightModeSuffix
let darkSuffix = colorParams?.darkModeSuffix
Copy link
Contributor

Choose a reason for hiding this comment

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

To maintain backward compatibility

Suggested change
let darkSuffix = colorParams?.darkModeSuffix
let darkSuffix = colorParams?.darkModeSuffix ?? "_dark"

Copy link
Author

Choose a reason for hiding this comment

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

This makes no sense for me. Someone can use suffix, someone can use prefix, but not both. So if I only have suffixes in my Figma, how would I configure my figma-export with such default values?

@subdan
Copy link
Collaborator

subdan commented Mar 28, 2024

Please, update CONFIG.md and README.md. Add information about prefixes.

Comment on lines -45 to -50
let lightColors = colors
.filter {
!$0.name.hasSuffix(darkSuffix) &&
!$0.name.hasSuffix(lightHCSuffix) &&
!$0.name.hasSuffix(darkHCSuffix)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you would like to specify light and dark colors in the same file, you can do so with the useSingleFile configuration option. You can then denote dark mode colors by adding a suffix like _dark.
(from https://github.com/RedMadRobot/figma-export?tab=readme-ov-file#design-requirements)

You must not delete this code. A color style list can contains colors which names doesn't contain prefixes and suffixes for light mode but contain "dark" suffix/prefix for dark mode. Example: "background", "foreground", "dark_background", "dark_foreground".

@subdan
Copy link
Collaborator

subdan commented Apr 8, 2024

@fedulvtubudul Do you plan to continue work on the PR?

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.

3 participants