Sha256: 6fc59a269a364e1480e35b07ba37eb1e0bae7f74162368c6edf19311f2332dbb
Contents?: true
Size: 1.82 KB
Versions: 8
Compression:
Stored size: 1.82 KB
Contents
// swiftlint:disable all // Generated using SwiftGen — https://github.com/SwiftGen/SwiftGen {% if palettes %} {% set enumName %}{{param.enumName|default:"ColorName"}}{% endset %} {% set accessModifier %}{% if param.publicAccess %}public{% else %}internal{% endif %}{% endset %} #if os(OSX) import AppKit {% if enumName != 'NSColor' %}{{accessModifier}} enum {{enumName}} { }{% endif %} #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit {% if enumName != 'UIColor' %}{{accessModifier}} enum {{enumName}} { }{% endif %} #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length // MARK: - Colors // swiftlint:disable identifier_name line_length type_body_length {{accessModifier}} extension {{enumName}} { {% macro h2f hex %}{{hex|hexToInt|int255toFloat}}{% endmacro %} {% macro enumBlock colors accessPrefix %} {% for color in colors %} /// 0x{{color.red}}{{color.green}}{{color.blue}}{{color.alpha}} (r: {{color.red|hexToInt}}, g: {{color.green|hexToInt}}, b: {{color.blue|hexToInt}}, a: {{color.alpha|hexToInt}}) {{accessPrefix}}static let {{color.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = #colorLiteral(red: {% call h2f color.red %}, green: {% call h2f color.green %}, blue: {% call h2f color.blue %}, alpha: {% call h2f color.alpha %}) {% endfor %} {% endmacro %} {% if palettes.count > 1 or param.forceFileNameEnum %} {% set accessPrefix %}{{accessModifier}} {% endset %} {% for palette in palettes %} enum {{palette.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { {% filter indent:2 %}{% call enumBlock palette.colors accessPrefix %}{% endfilter %} } {% endfor %} {% else %} {% call enumBlock palettes.first.colors "" %} {% endif %} } // swiftlint:enable identifier_name line_length type_body_length {% else %} // No color found {% endif %}
Version data entries
8 entries across 4 versions & 1 rubygems