GithubHelp home page GithubHelp logo

liuyuxuan123 / entouragecolor Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 1.55 MB

How to set correct color in your project & Correct Colors Management Template. 怎样为你的iOS项目设置正确的颜色 & 项目颜色管理模板

Swift 100.00%
swift colors gradient pattern scheme pokemon

entouragecolor's Introduction

Platform: iOS 8+ Language: Swift 4 Carthage compatible CocoaPods compatible License: MIT

怎样给你的项目设置正确的颜色

设置颜色的地方

  1. Interface Builder
  2. 代码中(Programmatically)

  无论是在什么位置设置UI组件的颜色,我们都需要保证我们颜色一致

表示颜色需要的两个值

  1. 一个表示颜色的值
  2. 一个颜色空间

表示颜色的值的几种不同模型

  1. RGBA(RGB) (红色,绿色,蓝色,Alpha)
  2. HSV(色调,饱和度,值)
  3. HSL(色调,饱和度,亮度)
  4. 和更多…

颜色空间的含义

 假设我们使用RGBA模型来声明一种颜色。使用这个模型,RGB通道中,每个通道的深度(depth)也就是在内存中占的位数8位,您最多可以表示255 x 255 x 255色=16581375(著名的1600万色),甚至更多,当您将它们与alpha分量结合时,您将达到40多亿(也称为真彩色)。这是使用这个模型可以表示的颜色数量,注意这个值是固定的,并且和选择的一个颜色空间的大小无关:您不能使用RGBA模型中表示处超过该数量的颜色。注意:使用更大的颜色空间不一定会获得更多的颜色,因为可以写下的颜色数量是有限制的。

 然而,改变的是,在处理较大的颜色空间时,两个连续值(例如:#A0A0A0#A0A0A1)之间的变化对眼睛更为明显。这是因为当使用更大的颜色空间时,更多的实际颜色必须适合相同数量的固定插槽。此外,在较大的颜色空间中,极端值将代表更生动的颜色(例如,p3中的#FF0000sRGB中的#FF0000更生动)。正是因为这些可观察到的变化,当你没有得到你想要的准确颜色时,你可能会头疼:也许你只是从一个颜色空间中获得他们的RGBA值,然后用不同的颜色空间在Xcode中生成它们。如果颜色空间不匹配,即使复制了相同的RGBA值,应用程序中的颜色也会不正确。

颜色空间区别 1. RGB值同为#F06464 2. RGB值同为#64C864 3. RGB值同为#0000FF

Entourage Color

UIColor Extension

Predefined Color and UIColor static function

Usage example

A few motivating and useful examples of how your product can be used. Spice this up with code blocks and potentially more screenshots.

For more examples and usage, please refer to the Wiki.

Release History

  • 0.0.3
  • Add more function
  • 0.0.2
  • Add README file
  • 0.0.1
  • First version

Meta

Yuxuan Liu – @liuyuxuan1996[email protected]

Contributing

  1. Fork it (https://github.com/yourname/yourproject/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

entouragecolor's People

Contributors

liuyuxuan123 avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.