Skip to content

Instantly share code, notes, and snippets.

@tgnivekucn
Created August 2, 2022 03:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tgnivekucn/58b48eae9d1fbaf7e83daf08fcf52915 to your computer and use it in GitHub Desktop.
Save tgnivekucn/58b48eae9d1fbaf7e83daf08fcf52915 to your computer and use it in GitHub Desktop.
Custom color identifier rule
Color identifier naming rule:
Regular expression:
(color)\.((common)|([A-Za-z])+(Page)){1}(\.([A-Za-z])+)*(\.([A-Za-z])+(Color)s?)$
Example:
1. Color category
2. UI page name or plist file name
3. Subview name(ex: customCell) (p.s. this field might be zero)
4. Unique color name (p.s. or unique color array name)
Correct example:
color.common.backgroundColor
color.common.customCell.dataColor
color.myPage.titleColor
color.myPage.testCell.titleColor
color.myPage.testCell.testView.titleColor
color.myPage.testCell.dataColors
Wrong example:
color.myPage
color.myPage.dataColor1
color.myPage1.titleColor
color.myPage.testCell
Note:
If you want to check whether the identifiter name matchs the rule or not, you can use below website tool with the regular expression above
Regular expression online validator: https://regexr.com/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment