- 浏览: 401052 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (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 929the "ready" event ... -
javascript - trick to simulate mouseenter and mouseleave
2012-08-23 08:31 2255Previously we discussed javasc ... -
javascript - trick to simulate the change event
2012-08-22 08:51 1671In the previous discussion a ... -
javascript - trick to simulate bubbling submit event
2012-08-22 08:03 909In the previous discussion abou ... -
javascript - trick to implement bubbling submit event
2012-08-23 07:55 706Following up to the javascrip ... -
javascript - trick to detect bubbling supportability
2012-08-20 22:22 974Event delegation is oe of the b ... -
javascript - trigger event and custom events
2012-08-20 21:58 2083In the previous post - javascri ... -
javascript - trick to handlers management
2012-08-20 08:19 1032We have discussed "javascr ... -
javascript - trick to centralized store
2012-08-20 07:52 822For a number of reasons it's ... -
javascript - trick to fix the event object
2012-08-20 07:47 885Many browsers, especially In ... -
javascript - trick to manipulate the opacity
2012-08-15 08:26 768All other browsre may have supp ... -
javascript - trick to test visibility of an element
2012-08-15 08:15 524though there is a visible prope ... -
javascript - trick to get and set height and width
2012-08-15 08:05 550when looking at properties t ... -
javascript - trick to set/get attributes that expects px values
2012-08-16 11:00 521When setting a number into a ... -
javascript - trick to get and set CSS style
2012-08-16 11:00 749while it will not be so much tr ... -
javascript - trick to normalize href for IE
2012-08-16 10:59 538IE is again the only browser th ... -
javascript - trick IE form and its expando attribute
2012-08-16 10:59 1043there is a known issue that if ... -
javascript expando and attributes
2012-08-14 08:15 1044expando is something like this ... -
javascript - trick to getText and setText
2012-08-14 07:40 1150it is not as simple as you thin ... -
javascript - trick/guideline to remove DOM element
2012-08-14 07:00 1182remove an element is not as sim ...
相关推荐
Android-android-tips-tricks.zip,[备忘]android开发的技巧,安卓系统是谷歌在2008年设计和制造的。操作系统主要写在爪哇,C和C 的核心组件。它是在linux内核之上构建的,具有安全性优势。
Pandas-Tips-Tricks-and-Best-Practices-main
cheatsheet-deep-learning-tips-tricks
CSS-Tricks
这个项目中的`warrenm-Core-Text-Tricks-1f8da11`可能是一个版本标识或者代码仓库的分支名称,它可能包含了实现这些功能的源代码。通过查看源码,开发者可以学习如何实际操作`Core Text`,并将其应用到自己的项目中...
spring-boot-upload-file-lead-to-rce-tricks一. docker 漏洞环境搭建docker pull landgrey/spring-boot-fat-jar-write-file-rce:1.2docker run -d -p 18081:18081 landgrey/spring-boot-fat-jar-write-file-rce:1.2...
D3-Tips-and-Tricks-Latest.pdf 最新版D3.js技法与教程,使用D3引擎进行前端数据可视化,一步一步学习D3的可视化编程
使用Keras的编程技巧 Keras-Tips-Tricks-and-Techniques-master.zip
资源来自pypi官网。 资源全名:json_tricks-3.13.4-py2.py3-none-any.whl
资源分类:Python库 所属语言:Python 资源全名:django-rest-framework-tricks-0.2.10.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
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笔记本的有用技巧和技巧。 无论如何,这不是对笔记本特性的详尽说明。 这里外,你可以以自己查阅这些...
"training-tricks.zip"这个压缩包文件,汇集了关于计算机视觉(CV)和自然语言处理(NLP)领域的神经网络训练技巧的论文,旨在帮助研究人员和开发者提升模型的准确性和训练速度。本文将围绕这些关键知识点进行深入...
这份"cheatsheet-machine-learning-tips-and-tricks.pdf"提供了一系列关键概念和度量标准,帮助我们理解和衡量分类与回归问题的解决方案。以下是其中的核心知识点: 1. **分类问题的度量**: - **混淆矩阵**:包含...
这份“cheatsheet-machine-learning-tips-and-tricks”压缩包提供了一份详细的机器学习技巧与窍门速查表,帮助我们在实际操作中提升效率并优化模型性能。以下是对其中关键知识点的详细解读: 1. 数据预处理:在机器...