UIColor / cgColor蜡笔调色板列表扩展

时间:2019-05-02 20:57:11

标签: swift uicolor cgcolor

不知道是否还有其他人会觉得有用。将Apple Crayon Colorlist转换为扩展程序。只需添加到您的项目中,编译器就会扩展调色板。


添加后的用法:例如:

self.shapeLayer.strokeColor = UIColor.aluminium.cgColor

//
//  UIColorExtension.swift
//
//  Created by Edward Hasted on 01/05/2019.
//  Copyright © 2019 Edward Hasted. All rights reserved.
//

import UIKit

extension UIColor {

    static let aluminium    = UIColor(red: 160/255, green: 159/255, blue: 160/255, alpha: 1)
    static let aqua         = UIColor(red: 0/255, green: 140/255, blue: 255/255, alpha: 1)
    static let asparagus    = UIColor(red: 136/255, green: 133/255, blue: 1/255, alpha: 1)
    static let banana       = UIColor(red: 255/255, green: 251/255, blue: 109/255, alpha: 1)
    static let blueberry    = UIColor(red: 0/255, green: 46/255, blue: 255/255, alpha: 1)
    static let bubblegum    = UIColor(red: 255/255, green: 122/255, blue: 255/255, alpha: 1)
    static let cantaloupe   = UIColor(red: 255/255, green: 206/255, blue: 110/255, alpha: 1)
    static let carnation    = UIColor(red: 255/255, green: 127/255, blue: 211/255, alpha: 1)
    static let cayenne      = UIColor(red: 137/255, green: 17/255, blue: 0/255, alpha: 1)
    static let clover       = UIColor(red: 2/255, green: 131/255, blue: 1/255, alpha: 1)
    static let eggplant     = UIColor(red: 73/255, green: 26/255, blue: 136/255, alpha: 1)
    static let fern         = UIColor(red: 69/255, green: 132/255, blue: 1/255, alpha: 1)
    static let flora        = UIColor(red: 104/255, green: 249/255, blue: 110/255, alpha: 1)
    static let grape        = UIColor(red: 137/255, green: 49/255, blue: 255/255, alpha: 1)
    static let honeydew     = UIColor(red: 206/255, green: 250/255, blue: 110/255, alpha: 1)
    static let ice          = UIColor(red: 104/255, green: 253/255, blue: 255/255, alpha: 1)
    static let iron         = UIColor(red: 84/255, green: 84/255, blue: 83/255, alpha: 1)
    static let lavender     = UIColor(red: 210/255, green: 120/255, blue: 255/255, alpha: 1)
    static let lead         = UIColor(red: 30/255, green: 30/255, blue: 30/255, alpha: 1)
    static let lemon        = UIColor(red: 255/255, green: 250/255, blue: 3/255, alpha: 1)
    static let lime         = UIColor(red: 131/255, green: 249/255, blue: 2/255, alpha: 1)
    static let liquorice    = UIColor(red: 0/255, green: 0/255, blue: 0/255, alpha: 1)
    static let mandarin     = UIColor(red: 255/255, green: 153/255, blue: 0/255, alpha: 1)
    static let magenta      = UIColor(red: 255/255, green: 57/255, blue: 255/255, alpha: 1)
    static let magnesium    = UIColor(red: 184/255, green: 184/255, blue: 184/255, alpha: 1)
    static let maraschino   = UIColor(red: 255/255, green: 33/255, blue: 1/255, alpha: 1)
    static let maroon       = UIColor(red: 137/255, green: 22/255, blue: 72/255, alpha: 1)
    static let mercury      = UIColor(red: 232/255, green: 232/255, blue: 232/255, alpha: 1)
    static let midnight     = UIColor(red: 0/255, green: 24/255, blue: 136/255, alpha: 1)
    static let mocha        = UIColor(red: 137/255, green: 72/255, blue: 0/255, alpha: 1)
    static let moss         = UIColor(red: 1/255, green: 132/255, blue: 72/255, alpha: 1)
    static let nickel       = UIColor(red: 136/255, green: 135/255, blue: 136/255, alpha: 1)
    static let ocean        = UIColor(red: 0/255, green: 74/255, blue: 136/255, alpha: 1)
    static let orchid       = UIColor(red: 110/255, green: 118/255, blue: 255/255, alpha: 1)
    static let salmon       = UIColor(red: 255/255, green: 114/255, blue: 110/255, alpha: 1)
    static let seafoam      = UIColor(red: 3/255, green: 249/255, blue: 135/255, alpha: 1)
    static let silver       = UIColor(red: 208/255, green: 208/255, blue: 208/255, alpha: 1)
    static let sky          = UIColor(red: 106/255, green: 207/255, blue: 255/255, alpha: 1)
    static let snow         = UIColor(red: 255/255, green: 255/255, blue: 255/255, alpha: 1)
    static let spindrift    = UIColor(red: 104/255, green: 251/255, blue: 208/255, alpha: 1)
    static let spring       = UIColor(red: 5/255, green: 248/255, blue: 2/255, alpha: 1)
    static let steel        = UIColor(red: 110/255, green: 110/255, blue: 110/255, alpha: 1)
    static let strawberry   = UIColor(red: 255/255, green: 41/255, blue: 135/255, alpha: 1)
    static let tangerine    = UIColor(red: 255/255, green: 136/255, blue: 2/255, alpha: 1)
    static let teal         = UIColor(red: 0/255, green: 134/255, blue: 136/255, alpha: 1)
    static let tin          = UIColor(red: 135/255, green: 134/255, blue: 135/255, alpha: 1)
    static let tungsten     = UIColor(red: 58/255, green: 58/255, blue: 58/255, alpha: 1)
    static let turquoise    = UIColor(red: 0/255, green: 253/255, blue: 255/255, alpha: 1)    
}

0 个答案:

没有答案