Back to Plugins
Color2Code

Color2Code

Export color variables into iOS & Android code format or Xcode Color Assets

code exportandroidiostokenscollectionvariablesxcodeassetscodeexportcolordev modecode-generators

Plugin Preview

Color2Code preview

About this plugin

This plugin exports color variables into iOS & Android code format and also exports as Xcode Color Assets.


Features

------------------------------------------

  • Exports iOS code format
  • Exports Xcode Color assets
  • Exports Android code format (Compose & XML)
  • Supports variable mode (Light/Dark & High Contrast modes)
  • Customize exported variable name
  • Works in Dev Mode


⚠️ Important Note

------------------------------------------

Before exporting color assets;

  • You should rename your modes' names to "Light" and "Dark."
  • The names for the high contrast modes should be "Light High Contrast" and "Dark High Contrast."



Variable

primary-color: #18B968;


Output for iOS

let primaryColor: UIColor = UIColor(UIColor(red: 24, green: 185, blue: 104))


Output for Android Compose

val primaryColor = Color(0xff18b968)


Output for Android XML

<color name="primaryColor">#ff18b968</color>


How to use

  1. Launch the plugin
  2. Select your collection
  3. Hit the “Generate” button
  4. Copy code format


Exporting Xcode Color Assets

  1. Enable "Export Xcode Color Assets" option
  2. Hit the “Generate” button
  3. Download fileName_Colors.zip file
  4. Drag and drop the folders in Xcode's Assets.xcassets


Customization

  • Remove group names: Removes group name from the variable name.
  • Camel case naming: Removes space, dash, and underscore from the variable name.
  • Ignore hierarchy: Available for exporting Xcode color assets. Ignores group hierarchy and creates color assets at the same level. If you have variables with the same name, this will export only one of them!
  • Color Space: Available for exporting Xcode color assets. Display P3, sRGB, Extended Range sRGB, and Extended Range Linear sRGB options are supported.
  • Input Method: Available for exporting Xcode color assets. Floating Point (0.0-0.1), 8-bit (0-255), and 8-bit Hexadecimal formats are supported.
  • Any Appearance: Available for exporting Xcode color assets.


------------------------------------------

For support

Buy me a coffee

------------------------------------------

Plugin Details

Version8
CreatedJuly 17, 2023
Last UpdatedJanuary 23, 2024
CategorySoftware development
CreatorBurak
Stats277 installs, 45 likes
PricingFree

Technical Details

  • API:1.0.0
  • UI:dist/ui.html
  • main:dist/code.js
  • Editor Types:
    figma
  • Allowed Domains:
    • none