Giter VIP home page Giter VIP logo

wonderful's Introduction

Wonderful

Platform Language License CocoaPods Version

一个关于色彩的库

image



ChangeLog 1.2.1

1.2.1版本修复了:

有marquee或是headline组件的页面,后台回到前台偶现错乱的问题

有marquee或是headline组件的页面,�停留在当前页面,锁屏解锁偶现错乱的问题

允许marquee在运行中修改文字

Demo程序截图

建议使用iPhone6运行Demo程序
Drawing

一、UIColor+Wonderful

1.这个分类里扩充了更多的颜色扩展,以后随手写个小Demo再也不需要redColor buleColor了。

	self.view.backgroundColor = [UIColor khakiColor];
	self.view.backgroundColor = [UIColor chocolateColor];

2.平均每个色系有10种颜色,不仅可以使用名称直接敲出,还能使用颜色阶梯的宏敲出,在你想不起词的时候更加方便。 宏从1~10是颜色渐深,可以根据自己的感觉使用浅一级的宏或深一级的宏。

	self.view.backgroundColor = Wonderful_YelloeColor4;
	self.view.backgroundColor = Wonderful_BrownColor4;

Drawing

Drawing


二、UIColor+Separate

1.提供颜色分离方案,可以将任何颜色的rgb喝alpha的值取出。

	UIColor *testC = [UIColor salmonColor];
	float r= [testC red];
	float g= [testC green];
	float b= [testC blue];
	float alpha= [testC alpha];
	NSLog(@"******  %f,%f,%f,%f",r,g,b,alpha);

2.可以通过一个颜色算出此颜色的反色,使得背景无论被用户设置成什么色,文字颜色都是背景的反色。

self.showLbl1.backgroundColor = [UIColor peachRed];
self.showLbl1.textColor = [[UIColor peachRed]reverseColor];

3.也可以直接打印这个颜色的各项详细数值。

[[UIColor salmonColor]printDetail];
// 打印结果
This Color's Red:250, Green:128, Blue:114, Alpha:1
decimal red:0.9804 green:0.5020 blue:0.4471
Hexadecimal 0xfa8072

4.提供了颜色微调方案,可以让一个已知颜色的rgb的某值上升或下降若干,可用于不管背景是什么色,边框都比背景深20。 也可以将认可颜色的详细值打印出来。

	UIColor *navColor = [[UIColor redColor]up:SXColorTypeBlue num:30]; // 在红色上把蓝色色值提高30
	UIColor *barColor = [[UIColor blueColor]up:1 num:140]; // 可以直接用枚举对应的tag
	UIColor *bgColor = [[UIColor blackColor]down:SXColorTypeAlpha num:10]; // 取一个比黑色稍微淡的颜色
	UIColor *lineColor = [bgColor up:3 num:20]; // 不管背景是什么颜色 线都比背景浅20.

image

三、SXColorGradientView

1.颜色渐变的view,可以设置任何颜色到透明的过渡。

SXColorGradientView *grv1 = [SXColorGradientView createWithColor:[UIColor paleGreen] frame:CGRectMake(10, 10, 80, 30) visible:YES direction:SXColorGradientToRight];

2.也可以设置两个颜色相互过渡。

SXColorGradientView *grv3 = [SXColorGradientView createWithFromColor:[UIColor peruColor] toColor:[UIColor ghostWhite] frame:CGRectMake(10, 50, 80, 30) direction:SXColorGradientToRight];

3.可以设置向上下左右四个过渡的方向。

typedef NS_ENUM(NSInteger, SXColorGradientDirection) {
	SXColorGradientToTop = 1,
	SXColorGradientToLeft = 2,
	SXColorGradientToBottom = 3,
	SXColorGradientToRight = 4,
};

4.支持增加传入一个数组,然后搭建一个多个颜色过渡的view。
Drawing

四、SXMarquee

1.实现任何样式的跑马灯。

SXMarquee *mar3 = [[SXMarquee alloc]initWithFrame:CGRectMake(20, 390, 335, 25) speed:2 Msg:@"If you've submitted an update to fix a critical bug in your app on the App Store and you are requesting an expedited review." bgColor:[UIColor goldColor] txtColor:[UIColor goldenrod]];
[mar3 changeMarqueeLabelFont:[UIFont boldSystemFontOfSize:12]]; // 可以用默认也可以配置更多属性
[mar3 start];

2.跑马灯的背景可以设置任何颜色,这个是基于颜色过渡view做的。
3.跑马灯可以实现点击拖动,或者绑定更多点击事件。
image

五、SXColorLabel

1.把text里重要的内容用特殊符号包起来,就会特殊显示
Drawing
​ ​ 2.如果用<>包起来,就会显示高亮颜色。如果用[]包起来,就会显示高亮的字体。

lbl.text = @"例1:今天要记得通知<Peter>和<Robin>去开会。";
lbl2.text = @"例2:礼物很有[粪]量,你会大吃一[斤]!";

3.这个高亮颜色和高亮字体可以自行设置。

[SXColorLabel setAnotherColor:[UIColor salmonColor]];
[SXColorLabel setAnotherFont:[UIFont boldSystemFontOfSize:18]];

4.两者也可以混合使用。 高亮的字体里有高亮颜色。

lbl3.text = @"例3:一定要:[通知<Peter>和<Robin>去开会]";

旧版demo
颜色列表
image

wonderful's People

Contributors

boai avatar bryant1410 avatar carnival7 avatar dsxniubility avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wonderful's Issues

randomAColorEntity 有点问题

建议这样修改:

- (SXCLEntity *)randomAColorEntity
{
    NSInteger x1 = arc4random() % 10;
    NSArray *ary1 = self.marray[x1];
    NSInteger y1 = arc4random() % ary1.count;
    return ary1[y1];
}

意见:SXColorLabel

SXColorLabel设置字体和颜色,如果类方法和实例方法一起都可以设置便方便多了;
SXColorLabel如果一行文本可以设置多个颜色就完美了!!

跑马灯

跑马灯切到后排再回来会消失

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.