Add a custom color palette to XCode Interface Builder

后端 未结 3 1408
走了就别回头了
走了就别回头了 2020-12-29 18:27

My current long term project utilizes a palette of custom colors. In code, we are using a category to access these colors by name. This works great but there are times, such

相关标签:
3条回答
  • 2020-12-29 18:59

    Xcode 9

    You now have another option to add Color Sets or Named Colors to your assets. This is new in Xcode 9.

    1. Adding Named Colors to Your Project

    In *.xcassets > right-click > New Color Set

    2. Assigning Name Colors to Views

    Your new Named Colors show up in your Color Picker now in their own section.

    0 讨论(0)
  • 2020-12-29 19:02

    Custom Color Palette

    In the Interface Builder's color dialog, choose the third tab. Click the gear and New to make a new custom color palette. You can name it whatever you want. Then click the plus (+) button to add a new color and name it. Use the color picker tool to set the color.

    Colors from RGB or Hex

    Choose the second tab in the color dialog and select RGB Sliders. This will allow you to set the colors using RGB or hex values.

    More Help

    • XCode Tip: Color Palette
    • How to define colors in XCodes' Interface Builder?
    • How do I enter RGB values into Interface Builder?
    0 讨论(0)
  • 2020-12-29 19:08

    Yes, you can create and edit a palette in IB and then share it with your team This article has all the details: http://natashatherobot.com/xcode-color-palette/

    0 讨论(0)
提交回复
热议问题