- 浏览: 389142 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (309)
- xaml C# wpf (0)
- scala java inner clas (1)
- Tools UML Eclipse UML2 (1)
- Timer .NET Framework (1)
- perl (6)
- python function paramter (1)
- Python Docstring (1)
- Python how to compare types (1)
- Python (8)
- java (5)
- C# (76)
- C# WPF (0)
- p4 (0)
- WPF (46)
- .net (6)
- xaml (1)
- javascript (40)
- windows (10)
- scala (4)
- winform (1)
- c++ (48)
- tools (12)
- cmd (1)
- os (0)
- CI (0)
- shell (0)
- C (2)
- haskell (49)
- functional (1)
- tool (1)
- gnu (1)
- linux (1)
- kaskell (0)
- svn (0)
- wcf (3)
- android (1)
最新评论
There are a couple of ways to represent a color information. and it always cause confusion across different browsers.
• rgb(R,G,B) - Where R, G, B are numbers from 0 to 255.
• rgb(R%,G%,B%) - Where R, G, B are numbers from 0% to 100%.
• #RRGGBB - Where RR, GG, BB are hexadecimal representations of the numbers 0 through 255.
• #RGB - Where R, G, B are hexadecimal representations similar to the previous one, but in shorthand
(e.g. #F54 is equal to #FF5544).
• red, blue, etc. - The name representing a set of RGB values.
the following code is from the jQuery and is written by jQuery's color plugin's author, I am showing it here to manifest just a reminder of the different of different colors.
/************************************** *@Name: expandoattr.js *@Summary * this function shows hwo you can parse colors in different format to a single format. * * ***************************************/ var num = /rgb\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/, pc = /rgb\(\s*([0-9.]+)%\s*,\s*([0-9.]+)%\s*,\s*([0-9.]+)%\s*\)/, hex = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/, hex2 = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/; // Parse strings looking for color tuples [255,255,255] function getRGB(color) { var result; // Look for rgb(num,num,num) if (result = num.exec(color)) return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])]; // Look for rgb(num%,num%,num%) if (result = pc.exec(color)) return [parseFloat(result[1]) * 2.55, parseFloat(result[2]) * 2.55, parseFloat(result[3]) * 2.55]; // Look for #a0b1c2 if (result = hex.exec(color)) return [parseInt(result[1], 16), parseInt(result[2], 16), parseInt(result[3], 16)]; // Look for #fff if (result = hex2.exec(color)) return [parseInt(result[1] + result[1], 16), parseInt(result[2] + result[2], 16), parseInt(result[3] + result[3], 16)]; // Otherwise, we're most likely dealing with a named color return colors[color.replace(/\s+/g, "").toLowerCase()]; } // Map color names to RGB values var colors = { aqua: [0, 255, 255], azure: [240, 255, 255], beige: [245, 245, 220], black: [0, 0, 0], blue: [0, 0, 255], // ... snip ... silver: [192, 192, 192], white: [255, 255, 255], yellow: [255, 255, 0] };
发表评论
-
javascript - trick to cross browser DOM ready event
2012-08-24 08:23 900the "ready" event ... -
javascript - trick to simulate mouseenter and mouseleave
2012-08-23 08:31 2226Previously we discussed javasc ... -
javascript - trick to simulate the change event
2012-08-22 08:51 1610In the previous discussion a ... -
javascript - trick to simulate bubbling submit event
2012-08-22 08:03 881In the previous discussion abou ... -
javascript - trick to implement bubbling submit event
2012-08-23 07:55 669Following up to the javascrip ... -
javascript - trick to detect bubbling supportability
2012-08-20 22:22 932Event delegation is oe of the b ... -
javascript - trigger event and custom events
2012-08-20 21:58 2044In the previous post - javascri ... -
javascript - trick to handlers management
2012-08-20 08:19 995We have discussed "javascr ... -
javascript - trick to centralized store
2012-08-20 07:52 783For a number of reasons it's ... -
javascript - trick to fix the event object
2012-08-20 07:47 848Many browsers, especially In ... -
javascript - trick to manipulate the opacity
2012-08-15 08:26 743All other browsre may have supp ... -
javascript - trick to test visibility of an element
2012-08-15 08:15 494though there is a visible prope ... -
javascript - trick to get and set height and width
2012-08-15 08:05 519when looking at properties t ... -
javascript - trick to set/get attributes that expects px values
2012-08-16 11:00 492When setting a number into a ... -
javascript - trick to get and set CSS style
2012-08-16 11:00 718while it will not be so much tr ... -
javascript - trick to normalize href for IE
2012-08-16 10:59 506IE is again the only browser th ... -
javascript - trick IE form and its expando attribute
2012-08-16 10:59 1007there is a known issue that if ... -
javascript expando and attributes
2012-08-14 08:15 1009expando is something like this ... -
javascript - trick to getText and setText
2012-08-14 07:40 1105it is not as simple as you thin ... -
javascript - trick/guideline to remove DOM element
2012-08-14 07:00 1155remove an element is not as sim ...
相关推荐
D3-Tips-and-Tricks_Book
Android-android-tips-tricks.zip,[备忘]android开发的技巧,安卓系统是谷歌在2008年设计和制造的。操作系统主要写在爪哇,C和C 的核心组件。它是在linux内核之上构建的,具有安全性优势。
cheatsheet-deep-learning-tips-tricks
cheatsheet-machine-learning-tips-and-tricks
cheatsheet-deep-learning-tips-tricks.pdf
CSS-Tricks
cheatsheet-machine-learning-tips-and-tricks.pdf
书 python-tricks-buffet-awesome-features pdf格式和epub格式
NVIDIA CUDA使用优化技巧指南《cuda-optimization-tips-tricks-and-techniques》。
D3-Tips-and-Tricks-Latest.pdf 最新版D3.js技法与教程,使用D3引擎进行前端数据可视化,一步一步学习D3的可视化编程
使用Keras的编程技巧 Keras-Tips-Tricks-and-Techniques-master.zip
TASKING TriCore tools Linker tips - tricks-WEB.pdf
资源分类:Python库 所属语言:Python 资源全名:django-rest-framework-tricks-0.2.10.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
藏经阁-Tricks of the Trade.pdf
Sams - Tricks Of The 3D Game Programming Gurus - Advanced 3D Graphics And Rasterization pdf格式的 快50M大小 智能分四个文件了 第4部分 共4部分
Although we have no doubt that there are many tricks we have missed, we hope that what we have included will prove to be useful, particularly to those who are relatively new to the field. Each ...
jupyter-tips-and-tricks, 将项目Jupyter用于数据科学 Jupyter笔记本提示和技巧一些( 希望) 用于使用Jupyter笔记本的有用技巧和技巧。 无论如何,这不是对笔记本特性的详尽说明。 这里外,你可以以自己查阅这些...