YUI Library Examples: Color Picker Control: Skinning Example

Color Picker Control: Skinning Example

The purpose of this example is to call out explicitly the CSS used to create the look and feel of the Color Picker Control so that you may more easily modify it in your own implementations. In the description below, the full CSS for Color Picker is displayed.

  • R
  • G
  • B

The Color Picker Control and the YUI Sam Skin

YUI controls that support "skinning" generally have two levels of CSS: one that is core to the control and its functioning and another that is purely presentational. As a rule, you should avoid changes that affect the core CSS for a skinned control; rather, you should modify the presentation of a control by building upon (or replacing) its skin-level CSS. For more information about the skinning of YUI controls, please review our skinning reference article which goes into much more detail about how skins are created and how they operate.

The Color Picker Control is a skinned control whose CSS is entirely presentational; that is, the Color Picker has no "core" CSS but only a skin-level CSS. The CSS for the default YUI Sam Skin is displayed below. To modify the presentation of your Color Picker instance, add rules that override those you see here or use this CSS block as a starting point for creating your own custom Color Picker skin.

1/*
2Copyright (c) 2007, Yahoo! Inc. All rights reserved.
3Code licensed under the BSD License:
4http://developer.yahoo.net/yui/license.txt
5version: 2.4.0
6*/ 
7
8.yui-picker-panel { 
9    background: #e3e3e3
10    border-color: #888
11} 
12
13.yui-picker-panel .hd { 
14    background-color:#ccc; 
15    font-size:100%
16    line-height:100%
17    border:1px solid #e3e3e3
18    font-weight:bold
19    overflow:hidden
20    padding6px
21    color: #000
22} 
23
24.yui-picker-panel .bd { 
25    background: #e8e8e8
26    margin1px
27    height200px
28} 
29
30.yui-picker-panel .ft { 
31    background: #e8e8e8
32    margin1px
33    padding1px
34             /*
35    text-align: center;
36    */ 
37} 
38
39.yui-picker { 
40    positionrelative
41} 
42
43.yui-picker-hue-thumb { cursor:defaultwidth:18pxheight:18px;  
44top-8px
45left-2px
46    z-index9position:absolute} 
47.yui-picker-hue-bg {-moz-outlinenoneoutline:0px none
48    position:absoluteleft:200pxheight:183pxwidth:14px
49    background:url(hue_bg.png) no-repeat;  
50    top:4px;  
51} 
52
53.yui-picker-bg { 
54    -moz-outlinenone;  
55    outline:0px none;  
56    position:absolute;  
57    top:4px
58    left:4px;  
59    height:182px;  
60    width:182px;  
61    background-color:#F00;  
62    background-imageurl(picker_mask.png); 
63}  
64
65*html .yui-picker-bg { 
66    background-imagenone
67    filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../../build/colorpicker/assets/picker_mask.png'sizingMethod='scale'); 
68} 
69
70
71.yui-picker-mask { position:absolutez-index1top:0pxleft:0px}  
72
73.yui-picker-thumb { cursor:defaultwidth:11pxheight:11pxz-index9position:absolute;  
74    top:-4pxleft:-4px} 
75
76.yui-picker-swatch { position:absoluteleft:240pxtop:4pxheight:60px
77    width:55pxborder:1px solid #888} 
78.yui-picker-websafe-swatch { position:absoluteleft:304pxtop:4px
79    height:24pxwidth:24pxborder:1px solid #888} 
80
81.yui-picker-controls { position:absolutetop72pxleft:226pxfont:1em monospace;} 
82.yui-picker-controls .hd { backgroundtransparentborder-width0px !important;} 
83.yui-picker-controls .bd { height100pxborder-width0px !important;} 
84.yui-picker-controls ul {float:left;padding:0 2px 0 0;margin:0
85.yui-picker-controls li {padding:2px;margin:0;list-style:none;} 
86.yui-picker-controls input {  
87    font-size0.85em
88    width2.4em
89} 
90.yui-picker-hex-controls {  
91    clearboth;  
92    padding2px
93} 
94.yui-picker-hex-controls input {  
95    width4.6em
96} 
97
98.yui-picker-controls a { 
99    font1em arial,helvetica,clean,sans-serif; 
100    display:block
101    *display:inline-block/* IE */ 
102    padding0
103    color: #000
104 
105} 
view plain | print | ?

Copyright © 2008 Yahoo! Inc. All rights reserved.

Privacy Policy - Terms of Service - Copyright Policy - Job Openings