精华内容
下载资源
问答
  • 颜色代码六位十六进制字符 One of the most requested capabilities in my early days of web development was the ability to set opacity on elements and even PNG images without the need for browser-specific...

    颜色代码六位十六进制字符

    One of the most requested capabilities in my early days of web development was the ability to set opacity on elements and even PNG images without the need for browser-specific CSS or hacks.  Eventually we got native opacity support and even enjoyed rgba(), the ability to cite an opacity level with a color.

    在我进行Web开发的初期,最需要的功能之一是无需设置特定浏览器CSS或黑客程序即可在元素甚至PNG图像上设置不透明度的功能。 最终,我们获得了本机不透明度支持,甚至享受了rgba() ,它可以用颜色引用不透明度级别。

    While I loved the ability to provide an opacity with color using rgba(), the use of hexadecimal color had always been ingrained in me, which made the sudden need for rgba conversions annoying.  Luckily these days we have 8 digit hex values with allow us to cite an opacity level as the last two characters of the hex value!

    虽然我喜欢使用rgba()为颜色提供不透明性的能力,但十六进制颜色使用一直根深蒂固,这使对rgba转换的突然需求变得烦人。 幸运的是,这些天我们有8位十六进制值,允许我们将不透明度级别作为十六进制值的最后两个字符!

    CSS (The CSS)

    Hex implies "six" but the last two digits of the 8 character hex value are the opacity value:

    十六进制表示“六个”,但是8个字符的十六进制值的最后两位是不透明度值:

    
    .myElement {
        /* { red/50% opacity } */
        /* pink of white background */
        background: #ff000080;
    }
    
    
    

    I love that we can use hexidecimal colors with the additional opacity value; needing to convert to rgba to take advantage of opacity was a needless frustration.  I owe something to the creator of this API!

    我喜欢我们可以将十六进制颜色与附加的不透明度值一起使用; 需要转换为rgba以利用不透明性是不必要的挫败感。 我欠这个API的创建者!

    翻译自: https://davidwalsh.name/8-digit-hex

    颜色代码六位十六进制字符

    展开全文
  • 十六进制颜色代码

    2017-09-20 10:50:00
    每个十六进制代码前都有 # 号,然后跟着六位数字。这些数字的范围是从#ffffff(白色)到#000000(黑色)。 #ffffff, #eeeeee, #dddddd, #cccccc, #bbbbbb, #aaaaaa, #999999, #888888, #777777, #666666,...
    • 每个十六进制代码前都有 # 号,然后跟着六位数字。这些数字的范围是从 #ffffff(白色)到#000000(黑色)。
    • #ffffff, #eeeeee, #dddddd, #cccccc, #bbbbbb, #aaaaaa, #999999, #888888, #777777, #666666, #555555, #444444, #333333, #222222, #111111
    • 前两位表示红色,第三和第四代表绿色,而最后两位代表蓝色。
    • #ff0000 是红色(red)。#550000 是暗红色(dark red)。 #220000 是更黑色的红色(darker red)。
    • #00ff00 是绿色(green)。
    • #0000ff 是蓝色(blue)。
    • 那么哪个十六进制代码是黄色呢?
    • #ffff00 就是黄色(yellow)。
    • #ff00ff 是紫色(violet)

    转载于:https://www.cnblogs.com/xyfll7/p/7560276.html

    展开全文
  • 从JS-改变页面的颜色(一)、JS-改变页面的颜色(二)、JS-改变页面的颜色(三)三个简单的小白例,我们可以轻而易举的看到起变化的核心是——十六进制颜色值的获取方式,所以,我们这里总结一下获取六位随机数的...

    前言:JS-改变页面的颜色(一)JS-改变页面的颜色(二)JS-改变页面的颜色(三)三个简单的小白例,我们可以轻而易举的看到起变化的核心是——十六进制颜色值的获取方式,所以,我们这里总结一下获取六位随机数的方法都有那些。

    代码比较简单就不一个个解释了,不过总体的思路这里要简单的记录一下:

    一:需求,获取六位的数字随机数

    二:思路,关键就是怎么获取变化的数字

           1)通过前端的随机函数,来获取随机数,可以获取一位或者多位然后通过循环来拼接成六位,或者我们想要的任何位数

           2)获取随机数,除了通过随机函数,就是通过获取当前时间的毫秒后六位了,不过这样前面三位雷同的比较多,可以选择使用随机函数和毫秒数组合的方式来组合

           3)除了前端获取也可以通过发送请求到后台来获取,这样不同的后台语言有不同的方式,不过最总还是少不了使用随机函数的,只是使用的方式会有所变化

           4)参考资料Math对象的相关方法

                

            5)这里提供了获取六位随机数的思路,不过我们可以举一反三,获取任何的随机数,也可以通过一定范围内的随机和数组结合获取我们想要的任何随机字符的组合,这也是前端简单的验证码实现的一种思路

    1.

     

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8"/>
        <title>Get Random Num</title>
        <script>
            function getRandomNum() 
            {
               var randomNum = ""+Math.round(Math.random()*1000000);
               while(randomNum.length<6){randomNum="0"+randomNum;}
               console.info("randomNum is ========",randomNum);
               return randomNum;
            }       
        </script>
    </head>
    <body bgcolor="LightGoldenRodYellow" align="center">
        <input type="button" value="Please click ME and F12 !" onclick="getRandomNum();"/>
    </body>
    </html>

     

    2.

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8"/>
        <title>Get Random Num</title>
        <script>
            function getRandomNum() 
            {
               var randomNum = ""+Math.floor(Math.random()*1000000);;
               while(randomNum.length<6){randomNum="0"+randomNum;}
               console.info("randomNum is ========",randomNum);
               return randomNum;
            }       
        </script>
    </head>
    <body bgcolor="LightGoldenRodYellow" align="center">
        <input type="button" value="Please click ME and F12 !" onclick="getRandomNum();"/>
    </body>
    </html>

     

    3.

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8"/>
        <title>Get Random Num</title>
        <script>
            function getRandomNum() 
            {
               var randomNum = ""+Math.ceil(Math.random()*1000000);;
               while(randomNum.length<6){randomNum="0"+randomNum;}
               console.info("randomNum is ========",randomNum);
               return randomNum;
            }       
        </script>
    </head>
    <body bgcolor="LightGoldenRodYellow" align="center">
        <input type="button" value="Please click ME and F12 !" onclick="getRandomNum();"/>
    </body>
    </html>

     

    4.

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8"/>
        <title>Get Random Num</title>
        <script>
            function getRandomNum() 
            {
               var randomNum = (Math.random()+"").substr(2,6);
               console.info("randomNum is ========",randomNum);
               return randomNum;
            }       
        </script>
    </head>
    <body bgcolor="LightGoldenRodYellow" align="center">
        <input type="button" value="Please click ME and F12 !" onclick="getRandomNum();"/>
    </body>
    </html>

     

    5.

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8"/>
        <title>Get Random Num</title>
        <script>
            function getRandomNum() 
            {
               var randomNum = (Math.random()+"").substring(2,8);
               console.info("randomNum is ========",randomNum);
               return randomNum;
            }       
        </script>
    </head>
    <body bgcolor="LightGoldenRodYellow" align="center">
        <input type="button" value="Please click ME and F12 !" onclick="getRandomNum();"/>
    </body>
    </html>

     

    6.

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8"/>
        <title>Get Random Num</title>
        <script>
            function getRandomNum() 
            {
               var randomNum = "";
               for(var i=0;i<6;i++) 
               { 
                randomNum+=Math.floor(Math.random()*10); 
               } 
               console.info("randomNum is ========",randomNum);
               return randomNum;
            }
        </script>
    </head>
    <body bgcolor="LightGoldenRodYellow" align="center">
        <input type="button" value="Please click ME and F12 !" onclick="getRandomNum();"/>
    </body>
    </html>

     

    7.

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8"/>
        <title>Get Random Num</title>
        <script>
            function getRandomNum() 
            {
               var randomNum = (function(t){ var str =''; while (t--){ str += ~~(Math.random()*10) }; return str; })(6);
               console.info("randomNum is ========",randomNum,~~(Math.random()*10));
               return randomNum;
            }
        </script>
    </head>
    <body bgcolor="LightGoldenRodYellow" align="center">
        <input type="button" value="Please click ME and F12 !" onclick="getRandomNum();"/>
    </body>
    </html>

     

    8.

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8"/>
        <title>Get Random Num</title>
        <script>
            function getRandomNum() 
            {
               var randomNum = new Date().getTime()+'';
               randomNum = (Math.floor(Math.random() * 9) + 1).toString()+randomNum.substring(randomNum.length-5,randomNum.length);
               console.info("randomNum is ========",randomNum);
               return randomNum;
            }
        </script>
    </head>
    <body bgcolor="LightGoldenRodYellow" align="center">
        <input type="button" value="Please click ME and F12 !" onclick="getRandomNum();"/>
    </body>
    </html>

     

    9.

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8"/>
        <title>Get Random Num</title>
        <script>
            function getRandomNum() 
            {
               var randomNumTemp = /\d{5}$/.exec(+new Date()+'');
               var randomNum = (Math.floor(Math.random() * 9) + 1).toString()+randomNumTemp[0];
               console.info("randomNum is ========",randomNum);
               return randomNum;
            }
        </script>
    </head>
    <body bgcolor="LightGoldenRodYellow" align="center">
        <input type="button" value="Please click ME and F12 !" onclick="getRandomNum();"/>
    </body>
    </html>

     

    10.

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8"/>
        <title>Get Random Num</title>
        <script>
            function getRandomNum() 
            {
               var randomNum = Math.random()*900000|0+100000;
               console.info("randomNum is ========",randomNum);
               return randomNum;
            }
        </script>
    </head>
    <body bgcolor="LightGoldenRodYellow" align="center">
        <input type="button" value="Please click ME and F12 !" onclick="getRandomNum();"/>
    </body>
    </html>

     

    11.

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8"/>
        <title>Get Random Num</title>
        <script>
            function getRandomNum() 
            {
               var randomNum = Math.floor(Math.random()*900000 + 100000);
               console.info("randomNum is ========",randomNum);
               return randomNum;
            }
        </script>
    </head>
    <body bgcolor="LightGoldenRodYellow" align="center">
        <input type="button" value="Please click ME and F12 !" onclick="getRandomNum();"/>
    </body>
    </html>

     

    12.

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8"/>
        <title>Get Random Num</title>
        <script>
            function getRandomNum() 
            {
               var randomNum = (''+Math.random()).match(/\d{6}/)[0]
               console.info("randomNum is ========",randomNum);
               return randomNum;
            }
        </script>
    </head>
    <body bgcolor="LightGoldenRodYellow" align="center">
        <input type="button" value="Please click ME and F12 !" onclick="getRandomNum();"/>
    </body>
    </html>

     

    13.

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8"/>
        <title>Get Random Num</title>
        <script>
            function getRandomNum() 
            {
               var randomNum = (''+Math.random()).match(/[^0\.]\d{5}/)[0]
               console.info("randomNum is ========",randomNum);
               return randomNum;
            }
        </script>
    </head>
    <body bgcolor="LightGoldenRodYellow" align="center">
        <input type="button" value="Please click ME and F12 !" onclick="getRandomNum();"/>
    </body>
    </html>

     

    转载于:https://www.cnblogs.com/godtrue/p/5804185.html

    展开全文
  • 我们今天将介绍如何着色和十六进制颜色代码。 颜色属性,跟着的是一个十六进制代码,是用于给文本上色。如 body { color: #000000;} 意思是你页面 body 内所有文本将是黑色的。 背景颜色属性,跟着的是一个十六...
  • delphiXE TAlphaColor与TColor以及Html颜色代码之间的关系 ...其数值,即为全透明的TAlphaColor数值,即透明度为0,我们可以在其六位数值前两位(00-99)透明度值,99即代表 完全不透明。 //:16进制用...

    delphiXE TAlphaColor与TColor以及Html颜色代码之间的关系

    一、html颜色代码大全

    https://blog.csdn.net/sxc1414749109/article/details/79260543

    其数值,即为全透明的TAlphaColor数值,即透明度为0,我们可以在其六位数值前两位(00-99)透明度值,99即代表 完全不透明。

      //:16进制用"$"表示,每两位表示一种颜色,从左往右,HTML中颜色表示为"RGB"即:红绿蓝,而delphi中的颜色表示为"BGR"即:蓝绿红,HTML中纯蓝色#0000FF,DELPHI中的纯蓝色$FF0000 rgb(红,绿,蓝),三个的取值范围:0~255.如:rgb(255,0,0)纯红色.

    二、delphi颜色定义:uses System.UITypes;

    2.1、TColorRec

    TColorRec = record
      const
        SystemColor = $FF000000;
        // System Colors (仅针对Windows:)
        cSCROLLBAR = 0;
        cBACKGROUND = 1;
        cACTIVECAPTION = 2;
        cINACTIVECAPTION = 3;
        cMENU = 4;
        cWINDOW = 5;
        cWINDOWFRAME = 6;
        cMENUTEXT = 7;
        cWINDOWTEXT = 8;
        cCAPTIONTEXT = 9;
        cACTIVEBORDER = 10;
        cINACTIVEBORDER = 11;
        cAPPWORKSPACE = 12;
        cHIGHLIGHT = 13;
        cHIGHLIGHTTEXT = 14;
        cBTNFACE = 15;
        cBTNSHADOW = $10;
        cGRAYTEXT = 17;
        cBTNTEXT = 18;
        cINACTIVECAPTIONTEXT = 19;
        cBTNHIGHLIGHT = 20;
        c3DDKSHADOW = 21;
        c3DLIGHT = 22;
        cINFOTEXT = 23;
        cINFOBK = 24;
        cHOTLIGHT = 26;
        cGRADIENTACTIVECAPTION = 27;
        cGRADIENTINACTIVECAPTION = 28;
        cMENUHILIGHT = 29;
        cMENUBAR = 30;
        cENDCOLORS = cMENUBAR;
        cDESKTOP = cBACKGROUND;
        c3DFACE = cBTNFACE;
        c3DSHADOW = cBTNSHADOW;
        c3DHIGHLIGHT = cBTNHIGHLIGHT;
        c3DHILIGHT = cBTNHIGHLIGHT;
        cBTNHILIGHT = cBTNHIGHLIGHT;
        SysScrollBar = TColor(SystemColor or cSCROLLBAR);
        SysBackground = TColor(SystemColor or cBACKGROUND);
        SysActiveCaption = TColor(SystemColor or cACTIVECAPTION);
        SysInactiveCaption = TColor(SystemColor or cINACTIVECAPTION);
        SysMenu = TColor(SystemColor or cMENU);
        SysWindow = TColor(SystemColor or cWINDOW);
        SysWindowFrame = TColor(SystemColor or cWINDOWFRAME);
        SysMenuText = TColor(SystemColor or cMENUTEXT);
        SysWindowText = TColor(SystemColor or cWINDOWTEXT);
        SysCaptionText = TColor(SystemColor or cCAPTIONTEXT);
        SysActiveBorder = TColor(SystemColor or cACTIVEBORDER);
        SysInactiveBorder = TColor(SystemColor or cINACTIVEBORDER);
        SysAppWorkSpace = TColor(SystemColor or cAPPWORKSPACE);
        SysHighlight = TColor(SystemColor or cHIGHLIGHT);
        SysHighlightText = TColor(SystemColor or cHIGHLIGHTTEXT);
        SysBtnFace = TColor(SystemColor or cBTNFACE);
        SysBtnShadow = TColor(SystemColor or cBTNSHADOW);
        SysGrayText = TColor(SystemColor or cGRAYTEXT);
        SysBtnText = TColor(SystemColor or cBTNTEXT);
        SysInactiveCaptionText = TColor(SystemColor or cINACTIVECAPTIONTEXT);
        SysBtnHighlight = TColor(SystemColor or cBTNHIGHLIGHT);
        Sys3DDkShadow = TColor(SystemColor or c3DDKSHADOW);
        Sys3DLight = TColor(SystemColor or c3DLIGHT);
        SysInfoText = TColor(SystemColor or cINFOTEXT);
        SysInfoBk = TColor(SystemColor or cINFOBK);
        SysHotLight = TColor(SystemColor or cHOTLIGHT);
        SysGradientActiveCaption = TColor(SystemColor or cGRADIENTACTIVECAPTION);
        SysGradientInactiveCaption = TColor(SystemColor or cGRADIENTINACTIVECAPTION);
        SysMenuHighlight = TColor(SystemColor or cMENUHILIGHT);
        SysMenuBar = TColor(SystemColor or cMENUBAR);
        SysNone = TColor($1FFFFFFF);
        SysDefault = TColor($20000000);
        // 实际的颜色表:
        Aliceblue = TColor($FFF8F0);
        Antiquewhite = TColor($D7EBFA);
        Aqua = TColor($FFFF00);
        Aquamarine = TColor($D4FF7F);
        Azure = TColor($FFFFF0);
        Beige = TColor($DCF5F5);
        Bisque = TColor($C4E4FF);
        Black = TColor($000000);
        Blanchedalmond = TColor($CDEBFF);
        Blue = TColor($FF0000);
        Blueviolet = TColor($E22B8A);
        Brown = TColor($2A2AA5);
        Burlywood = TColor($87B8DE);
        Cadetblue = TColor($A09E5F);
        Chartreuse = TColor($00FF7F);
        Chocolate = TColor($1E69D2);
        Coral = TColor($507FFF);
        Cornflowerblue = TColor($ED9564);
        Cornsilk = TColor($DCF8FF);
        Crimson = TColor($3C14DC);
        Cyan = TColor($FFFF00);
        Darkblue = TColor($8B0000);
        Darkcyan = TColor($8B8B00);
        Darkgoldenrod = TColor($0B86B8);
        Darkgray = TColor($A9A9A9);
        Darkgreen = TColor($006400);
        Darkgrey = TColor($A9A9A9);
        Darkkhaki = TColor($6BB7BD);
        Darkmagenta = TColor($8B008B);
        Darkolivegreen = TColor($2F6B55);
        Darkorange = TColor($008CFF);
        Darkorchid = TColor($CC3299);
        Darkred = TColor($00008B);
        Darksalmon = TColor($7A96E9);
        Darkseagreen = TColor($8FBC8F);
        Darkslateblue = TColor($8B3D48);
        Darkslategray = TColor($4F4F2F);
        Darkslategrey = TColor($4F4F2F);
        Darkturquoise = TColor($D1CE00);
        Darkviolet = TColor($D30094);
        Deeppink = TColor($9314FF);
        Deepskyblue = TColor($FFBF00);
        Dimgray = TColor($696969);
        Dimgrey = TColor($696969);
        Dodgerblue = TColor($FF901E);
        Firebrick = TColor($2222B2);
        Floralwhite = TColor($F0FAFF);
        Forestgreen = TColor($228B22);
        Fuchsia = TColor($FF00FF);
        Gainsboro = TColor($DCDCDC);
        Ghostwhite = TColor($FFF8F8);
        Gold = TColor($00D7FF);
        Goldenrod = TColor($20A5DA);
        Gray = TColor($808080);
        Green = TColor($008000);
        Greenyellow = TColor($2FFFAD);
        Grey = TColor($808080);
        Honeydew = TColor($F0FFF0);
        Hotpink = TColor($B469FF);
        Indianred = TColor($5C5CCD);
        Indigo = TColor($82004B);
        Ivory = TColor($F0FFFF);
        Khaki = TColor($8CE6F0);
        Lavender = TColor($FAE6E6);
        Lavenderblush = TColor($F5F0FF);
        Lawngreen = TColor($00FC7C);
        Lemonchiffon = TColor($CDFAFF);
        Lightblue = TColor($E6D8AD);
        Lightcoral = TColor($8080F0);
        Lightcyan = TColor($FFFFE0);
        Lightgoldenrodyellow = TColor($D2FAFA);
        Lightgray = TColor($D3D3D3);
        Lightgreen = TColor($90EE90);
        Lightgrey = TColor($D3D3D3);
        Lightpink = TColor($C1B6FF);
        Lightsalmon = TColor($7AA0FF);
        Lightseagreen = TColor($AAB220);
        Lightskyblue = TColor($FACE87);
        Lightslategray = TColor($998877);
        Lightslategrey = TColor($998877);
        Lightsteelblue = TColor($DEC4B0);
        Lightyellow = TColor($E0FFFF);
        LtGray = TColor($C0C0C0);
        MedGray = TColor($A4A0A0);
        DkGray = TColor($808080);
        MoneyGreen = TColor($C0DCC0);
        LegacySkyBlue = TColor($F0CAA6);
        Cream = TColor($F0FBFF);
        Lime = TColor($00FF00);
        Limegreen = TColor($32CD32);
        Linen = TColor($E6F0FA);
        Magenta = TColor($FF00FF);
        Maroon = TColor($000080);
        Mediumaquamarine = TColor($AACD66);
        Mediumblue = TColor($CD0000);
        Mediumorchid = TColor($D355BA);
        Mediumpurple = TColor($DB7093);
        Mediumseagreen = TColor($71B33C);
        Mediumslateblue = TColor($EE687B);
        Mediumspringgreen = TColor($9AFA00);
        Mediumturquoise = TColor($CCD148);
        Mediumvioletred = TColor($8515C7);
        Midnightblue = TColor($701919);
        Mintcream = TColor($FAFFF5);
        Mistyrose = TColor($E1E4FF);
        Moccasin = TColor($B5E4FF);
        Navajowhite = TColor($ADDEFF);
        Navy = TColor($800000);
        Oldlace = TColor($E6F5FD);
        Olive = TColor($008080);
        Olivedrab = TColor($238E6B);
        Orange = TColor($00A5FF);
        Orangered = TColor($0045FF);
        Orchid = TColor($D670DA);
        Palegoldenrod = TColor($AAE8EE);
        Palegreen = TColor($98FB98);
        Paleturquoise = TColor($EEEEAF);
        Palevioletred = TColor($9370DB);
        Papayawhip = TColor($D5EFFF);
        Peachpuff = TColor($B9DAFF);
        Peru = TColor($3F85CD);
        Pink = TColor($CBC0FF);
        Plum = TColor($DDA0DD);
        Powderblue = TColor($E6E0B0);
        Purple = TColor($800080);
        Red = TColor($0000FF);
        Rosybrown = TColor($8F8FBC);
        Royalblue = TColor($E16941);
        Saddlebrown = TColor($13458B);
        Salmon = TColor($7280FA);
        Sandybrown = TColor($60A4F4);
        Seagreen = TColor($578B2E);
        Seashell = TColor($EEF5FF);
        Sienna = TColor($2D52A0);
        Silver = TColor($C0C0C0);
        Skyblue = TColor($EBCE87);
        Slateblue = TColor($CD5A6A);
        Slategray = TColor($908070);
        Slategrey = TColor($908070);
        Snow = TColor($FAFAFF);
        Springgreen = TColor($7FFF00);
        Steelblue = TColor($B48246);
        Tan = TColor($8CB4D2);
        Teal = TColor($808000);
        Thistle = TColor($D8BFD8);
        Tomato = TColor($4763FF);
        Turquoise = TColor($D0E040);
        Violet = TColor($EE82EE);
        Wheat = TColor($B3DEF5);
        White = TColor($FFFFFF);
        Whitesmoke = TColor($F5F5F5);
        Yellow = TColor($00FFFF);
        Yellowgreen = TColor($32CD9A);
        Null = TColor($00000000);
        class var ColorToRGB: function (Color: TColor): Longint;
    {    class operator Implicit(const C: TColor): TColorRec; inline;
        class operator Implicit(const C: TColorRec): TColor; inline;
        class operator Implicit(const C: TColorRec): Longint; inline;
        class operator Explicit(const C: TColorRec): Longint; inline;}
        case Cardinal of
          0:
            (Color: TColor);
          2:
            (HiWord, LoWord: Word);
          3:
    {$IFDEF BIGENDIAN}
            (A, B, G, R: System.Byte);
    {$ELSE}
            (R, G, B, A: System.Byte);
    {$ENDIF}
      end;

    2.2、TColor数值范围:

    TColor = -$7FFFFFFF-1..$7FFFFFFF;

    2.3、TAlphaColor

    TAlphaColor的表达(TAlphaColor和TColor之间的关系):

    方式1:上述TColor的常量数值,比如:Yellow,即Yellow=TColor($00FFFF);

    方式2:上述TColor函数的参数部分的反转加前缀‘#透明度’,比如:$00FFFF,反转后为:#FFFF00,同样是代表了颜色Yellow,

    但此时代表全透明,透明度为0,不透明的表达为:#99FFFF00。即:前缀‘#透明度’,00<透明度<99

    2.4、TAlphaColorRec

    TAlphaColorRec = record
      const
        Alpha = TAlphaColor($FF000000);
        Aliceblue = Alpha or TAlphaColor($F0F8FF);
        Antiquewhite = Alpha or TAlphaColor($FAEBD7);
        Aqua = Alpha or TAlphaColor($00FFFF);
        Aquamarine = Alpha or TAlphaColor($7FFFD4);
        Azure = Alpha or TAlphaColor($F0FFFF);
        Beige = Alpha or TAlphaColor($F5F5DC);
        Bisque = Alpha or TAlphaColor($FFE4C4);
        Black = Alpha or TAlphaColor($000000);
        Blanchedalmond = Alpha or TAlphaColor($FFEBCD);
        Blue = Alpha or TAlphaColor($0000FF);
        Blueviolet = Alpha or TAlphaColor($8A2BE2);
        Brown = Alpha or TAlphaColor($A52A2A);
        Burlywood = Alpha or TAlphaColor($DEB887);
        Cadetblue = Alpha or TAlphaColor($5F9EA0);
        Chartreuse = Alpha or TAlphaColor($7FFF00);
        Chocolate = Alpha or TAlphaColor($D2691E);
        Coral = Alpha or TAlphaColor($FF7F50);
        Cornflowerblue = Alpha or TAlphaColor($6495ED);
        Cornsilk = Alpha or TAlphaColor($FFF8DC);
        Crimson = Alpha or TAlphaColor($DC143C);
        Cyan = Alpha or TAlphaColor($00FFFF);
        Darkblue = Alpha or TAlphaColor($00008B);
        Darkcyan = Alpha or TAlphaColor($008B8B);
        Darkgoldenrod = Alpha or TAlphaColor($B8860B);
        Darkgray = Alpha or TAlphaColor($A9A9A9);
        Darkgreen = Alpha or TAlphaColor($006400);
        Darkgrey = Alpha or TAlphaColor($A9A9A9);
        Darkkhaki = Alpha or TAlphaColor($BDB76B);
        Darkmagenta = Alpha or TAlphaColor($8B008B);
        Darkolivegreen = Alpha or TAlphaColor($556B2F);
        Darkorange = Alpha or TAlphaColor($FF8C00);
        Darkorchid = Alpha or TAlphaColor($9932CC);
        Darkred = Alpha or TAlphaColor($8B0000);
        Darksalmon = Alpha or TAlphaColor($E9967A);
        Darkseagreen = Alpha or TAlphaColor($8FBC8F);
        Darkslateblue = Alpha or TAlphaColor($483D8B);
        Darkslategray = Alpha or TAlphaColor($2F4F4F);
        Darkslategrey = Alpha or TAlphaColor($2F4F4F);
        Darkturquoise = Alpha or TAlphaColor($00CED1);
        Darkviolet = Alpha or TAlphaColor($9400D3);
        Deeppink = Alpha or TAlphaColor($FF1493);
        Deepskyblue = Alpha or TAlphaColor($00BFFF);
        Dimgray = Alpha or TAlphaColor($696969);
        Dimgrey = Alpha or TAlphaColor($696969);
        Dodgerblue = Alpha or TAlphaColor($1E90FF);
        Firebrick = Alpha or TAlphaColor($B22222);
        Floralwhite = Alpha or TAlphaColor($FFFAF0);
        Forestgreen = Alpha or TAlphaColor($228B22);
        Fuchsia = Alpha or TAlphaColor($FF00FF);
        Gainsboro = Alpha or TAlphaColor($DCDCDC);
        Ghostwhite = Alpha or TAlphaColor($F8F8FF);
        Gold = Alpha or TAlphaColor($FFD700);
        Goldenrod = Alpha or TAlphaColor($DAA520);
        Gray = Alpha or TAlphaColor($808080);
        Green = Alpha or TAlphaColor($008000);
        Greenyellow = Alpha or TAlphaColor($ADFF2F);
        Grey = Alpha or TAlphaColor($808080);
        Honeydew = Alpha or TAlphaColor($F0FFF0);
        Hotpink = Alpha or TAlphaColor($FF69B4);
        Indianred = Alpha or TAlphaColor($CD5C5C);
        Indigo = Alpha or TAlphaColor($4B0082);
        Ivory = Alpha or TAlphaColor($FFFFF0);
        Khaki = Alpha or TAlphaColor($F0E68C);
        Lavender = Alpha or TAlphaColor($E6E6FA);
        Lavenderblush = Alpha or TAlphaColor($FFF0F5);
        Lawngreen = Alpha or TAlphaColor($7CFC00);
        Lemonchiffon = Alpha or TAlphaColor($FFFACD);
        Lightblue = Alpha or TAlphaColor($ADD8E6);
        Lightcoral = Alpha or TAlphaColor($F08080);
        Lightcyan = Alpha or TAlphaColor($E0FFFF);
        Lightgoldenrodyellow = Alpha or TAlphaColor($FAFAD2);
        Lightgray = Alpha or TAlphaColor($D3D3D3);
        Lightgreen = Alpha or TAlphaColor($90EE90);
        Lightgrey = Alpha or TAlphaColor($D3D3D3);
        Lightpink = Alpha or TAlphaColor($FFB6C1);
        Lightsalmon = Alpha or TAlphaColor($FFA07A);
        Lightseagreen = Alpha or TAlphaColor($20B2AA);
        Lightskyblue = Alpha or TAlphaColor($87CEFA);
        Lightslategray = Alpha or TAlphaColor($778899);
        Lightslategrey = Alpha or TAlphaColor($778899);
        Lightsteelblue = Alpha or TAlphaColor($B0C4DE);
        Lightyellow = Alpha or TAlphaColor($FFFFE0);
        LtGray = Alpha or TAlphaColor($C0C0C0);
        MedGray = Alpha or TAlphaColor($A0A0A0);
        DkGray = Alpha or TAlphaColor($808080);
        MoneyGreen = Alpha or TAlphaColor($C0DCC0);
        LegacySkyBlue = Alpha or TAlphaColor($F0CAA6);
        Cream = Alpha or TAlphaColor($F0FBFF);
        Lime = Alpha or TAlphaColor($00FF00);
        Limegreen = Alpha or TAlphaColor($32CD32);
        Linen = Alpha or TAlphaColor($FAF0E6);
        Magenta = Alpha or TAlphaColor($FF00FF);
        Maroon = Alpha or TAlphaColor($800000);
        Mediumaquamarine = Alpha or TAlphaColor($66CDAA);
        Mediumblue = Alpha or TAlphaColor($0000CD);
        Mediumorchid = Alpha or TAlphaColor($BA55D3);
        Mediumpurple = Alpha or TAlphaColor($9370DB);
        Mediumseagreen = Alpha or TAlphaColor($3CB371);
        Mediumslateblue = Alpha or TAlphaColor($7B68EE);
        Mediumspringgreen = Alpha or TAlphaColor($00FA9A);
        Mediumturquoise = Alpha or TAlphaColor($48D1CC);
        Mediumvioletred = Alpha or TAlphaColor($C71585);
        Midnightblue = Alpha or TAlphaColor($191970);
        Mintcream = Alpha or TAlphaColor($F5FFFA);
        Mistyrose = Alpha or TAlphaColor($FFE4E1);
        Moccasin = Alpha or TAlphaColor($FFE4B5);
        Navajowhite = Alpha or TAlphaColor($FFDEAD);
        Navy = Alpha or TAlphaColor($000080);
        Oldlace = Alpha or TAlphaColor($FDF5E6);
        Olive = Alpha or TAlphaColor($808000);
        Olivedrab = Alpha or TAlphaColor($6B8E23);
        Orange = Alpha or TAlphaColor($FFA500);
        Orangered = Alpha or TAlphaColor($FF4500);
        Orchid = Alpha or TAlphaColor($DA70D6);
        Palegoldenrod = Alpha or TAlphaColor($EEE8AA);
        Palegreen = Alpha or TAlphaColor($98FB98);
        Paleturquoise = Alpha or TAlphaColor($AFEEEE);
        Palevioletred = Alpha or TAlphaColor($DB7093);
        Papayawhip = Alpha or TAlphaColor($FFEFD5);
        Peachpuff = Alpha or TAlphaColor($FFDAB9);
        Peru = Alpha or TAlphaColor($CD853F);
        Pink = Alpha or TAlphaColor($FFC0CB);
        Plum = Alpha or TAlphaColor($DDA0DD);
        Powderblue = Alpha or TAlphaColor($B0E0E6);
        Purple = Alpha or TAlphaColor($800080);
        Red = Alpha or TAlphaColor($FF0000);
        Rosybrown = Alpha or TAlphaColor($BC8F8F);
        Royalblue = Alpha or TAlphaColor($4169E1);
        Saddlebrown = Alpha or TAlphaColor($8B4513);
        Salmon = Alpha or TAlphaColor($FA8072);
        Sandybrown = Alpha or TAlphaColor($F4A460);
        Seagreen = Alpha or TAlphaColor($2E8B57);
        Seashell = Alpha or TAlphaColor($FFF5EE);
        Sienna = Alpha or TAlphaColor($A0522D);
        Silver = Alpha or TAlphaColor($C0C0C0);
        Skyblue = Alpha or TAlphaColor($87CEEB);
        Slateblue = Alpha or TAlphaColor($6A5ACD);
        Slategray = Alpha or TAlphaColor($708090);
        Slategrey = Alpha or TAlphaColor($708090);
        Snow = Alpha or TAlphaColor($FFFAFA);
        Springgreen = Alpha or TAlphaColor($00FF7F);
        Steelblue = Alpha or TAlphaColor($4682B4);
        Tan = Alpha or TAlphaColor($D2B48C);
        Teal = Alpha or TAlphaColor($008080);
        Thistle = Alpha or TAlphaColor($D8BFD8);
        Tomato = Alpha or TAlphaColor($FF6347);
        Turquoise = Alpha or TAlphaColor($40E0D0);
        Violet = Alpha or TAlphaColor($EE82EE);
        Wheat = Alpha or TAlphaColor($F5DEB3);
        White = Alpha or TAlphaColor($FFFFFF);
        Whitesmoke = Alpha or TAlphaColor($F5F5F5);
        Yellow = Alpha or TAlphaColor($FFFF00);
        Yellowgreen = Alpha or TAlphaColor($9ACD32);
        Null = TAlphaColor($00000000);
        constructor Create(const Color: TAlphaColor);
        class var ColorToRGB: function (Color: TAlphaColor): Longint;
        case Cardinal of
          0:
            (Color: TAlphaColor);
          2:
            (HiWord, LoWord: Word);
          3:
    {$IFDEF BIGENDIAN}
            (A, R, G, B: System.Byte);
    {$ELSE}
            (B, G, R, A: System.Byte);
    {$ENDIF}
      end;

    三、根据“html颜色代码大全”设置TAlphaColor

    1、html颜色代码大全

    https://blog.csdn.net/sxc1414749109/article/details/79260543

    其数值,即为全透明的TAlphaColor数值,即透明度为0,我们可以在其六位数值前两位(00-99)透明度值,99即代表 完全不透明。

    2、组件的Fill.Color属性:即TAlphaColor

    根据:html颜色代码大全,将6位16进制前加两位透明度数值,即可

    #1A1A1A:代表纯色黄"Yellow"

    #851A1A1A:85%透明度的黄"Yellow",即黄"Yellow"的TAlphaColor数值

    四、简单的案例

    首先要弄清楚是否需要一个额外的类型限定符.
    TAlphaColors在“System.UITypes”单元中声明:
    Type
    TAlphaColors = TAlphaColorRec;
    一旦你清楚的知道这一点,那就OK了.
    当然,还有一个技巧可以绕过这个限定符的使用。直接引用“System.UIConsts
    元,然后您可以使用颜色值,如“claRed”,“claBlack”。
        Uses
        System.UIConsts;

        //...

    4.1、简单案例1

    memo1.FontColor := claRed; // Alternative:

    Rectangle6.Fill.Color := claRed;

    ARect.Stroke.Color:=claNull;//:也可://TAlphaColors.Null;//:也可:TAlphaColorRec.Null;//:也可:TAlphaColor($00000000);
     

    4.2、简单案例2

      for i:=240 downto 0 do //110
      begin//RGB(255,i,i)
        //LRectF :=TRectF.Create(300-I+120,300-I+120, 300+I-120, 300+I-120);
        LRectF :=TRectF.Create(300-I+100,300-I+100, 300+I-100, 300+I-100);
        Canvas.BeginScene;
          //Canvas.Fill.Color := TAlphaColorRec.ColorToRGB(TColor($C0C0C0)); //Silver = TColor($C0C0C0);
    //      Canvas.Fill.Color := TAlphaColorF.Create(255,i,i).ToAlphaColor; //Silver = TColor($C0C0C0);
          Canvas.Fill.Color := TAlphaColorRec.Silver;
          Canvas.DrawEllipse(LRectF,i);          //255,i,i //i,i,i
        Canvas.EndScene;
        sleep(20);
      end;//
      for i:=255 downto 240  do
      begin //RGB(240 + 255-i,240 + 255-i,240 + 255-i)
        LRectF :=TRectF.Create(300-I+100,300-I+100, 300+I-100, 300+I-100);
        Canvas.BeginScene;
          //Canvas.Pen.Color := TAlphaColorRec.ColorToRGB(TColor(i));
          //Canvas.Fill.Color := TAlphaColorRec.ColorToRGB(TColor($FFFFFF));//White:$FFFFFF
          Canvas.Fill.Color := TAlphaColorF.Create(240 + 255-i,240 + 255-i,255-i).ToAlphaColor; //Silver = TColor($C0C0C0);
          if i<>240 then                       //240 + 255-i,240 + 255-i,255-i //i,i,i
            Canvas.DrawEllipse(LRectF,(100-i/100)/100)
          else Canvas.DrawEllipse(LRectF,0);

        Canvas.EndScene;
        sleep(20);
      end;//

     

    展开全文
  • 安卓中颜色有八位十六进制编码和六位十六进制编码。使用八位十六进制编码时,xml文件和代码中都一样。 使用六位十六进制编码时。...所以在代码中使用六位十六进制的颜色差不多和没有设置一样(透明的 )。 ...
  • 颜色

    2017-06-24 15:18:56
    颜色的编码 Android中颜色值的定义是由透明度alpha和RGB(红绿蓝)三原色来定义的,有八位十六进制数与六位十六进制数两种编码,例如...六位编码有两种情况,在XML文件中默认不透明(即透明度为FF),在代码中默认透明
  • ASS代码自用

    2020-01-16 14:36:43
    ass格式及规范 https://www.douban.com/note/658520175/ ass颜色代码 格式c&HXXXXXX 后六位为颜色十六进制编码,反向输入,即BGR顺序。 https://www.cnblogs.com/xmm2017/p/8441124.html ...
  • Android中的颜色

    2017-07-25 17:44:00
    【Tip】既然代码中的六位编码表示颜色时,是透明的,也就相当于没有设置,所以在代码中就不要使用六位编码表示颜色。 Android中颜色值的定义是由透明度alpha和RGB(红绿蓝)三原色来定义的,有八位十六进制数与六位...
  • 色值的透明度与十六进制代码转换

    万次阅读 2016-10-26 15:46:43
    解析:〈#ffffffff〉#ffffffff由#加八位数字或字母组成,前两个ff为透明度(十六进制),后面六位ffffff为颜色代码,采用RGB配色(十六进制)需要修改的机油一般都要查找相关资料,这里教你一个更快捷的方法!...
  • android-03颜色

    2019-12-24 09:20:00
    六位十六进制数字和八位十六进制数字 ...XML中默认不透明、代码中默认透明,代码中不能用六位 系统中有十二中已经定义好的颜色,在Color类中 布局文件中 android:textColor="#000000" setTextColor(0xff0...
  • CSS颜色表示方法

    2019-11-26 22:23:59
    rgb(red,green,blue),每一个值由两位十六进制数组成,共由六位十六进制数组成,如:#000000为黑色,#ff0000为红色; 颜色函数: rgb(255,255,255),每一位数字范围为0-255,为十进制数。 ...
  • 透明度十六进制代码

    2018-05-12 23:03:59
    解析:〈#ffffffff〉#ffffffff由#加八位数字或字母组成,前两个ff为透明度(十六进制),后面六位ffffff为颜色代码,采用RGB配色(十六进制)需要修改的机油一般都要查找相关资料,这里教你一个更快捷的方法!...
  • 、支持标题栏背景颜色渐变和字体颜色渐变。 七、实现了数据不足一屏动态添加空数据占位。 八、数据为空时ListView多type加载暂无数据视图。 应用截图 动态效果图 实现思路参考简书文章 扫一扫Fir.im...
  • ColorFilter设置颜色

    2019-04-22 10:33:16
    #开头的六位十六进制数仅仅表示颜色 0x开头的数字表示包括颜色在内的一般数值。 代码如下: import android.graphics.Color; import android.graphics.LightingColorFilter; import android.graphics....
  • 生成随机颜色函数

    2020-12-14 08:58:52
    代码可以生成一个 十六进制位数随机颜色 跟255类似 可以直接放在代码中使用。 function () { var sum = "" for (var i = 0; i < 6; i++) { sum += Math.floor(Math.random() * 16).toString(16) } ...
  • 颜色像素(Day_three)

    2019-09-07 22:02:32
    透明色transparent 设置颜色三种方式 ...#号开头一共六位代码:#000000 到 #FFFFFF 颜色 范围 red 00-FF 表示红色的饱和程度 blue 00-FF 表示蓝色的饱和程度 green 00-FF 表示绿色的饱和程度 ...
  • 解析:〈#ffffffff〉#ffffffff由#加八位数字或字母组成,前两个ff为透明度(十六进制),后面六位ffffff为颜色代码,采用RGB配色(十六进制) 透明度参照表: 00% FF(不透明) 50% 7F 5% F2 55% ...
  • 首先查RGB颜色表灰色是:#9E9E9E,AA代表透明,(透明度从00到FF,00表示完全透明),所以,设置其属性:android:background="#AA9E9E9E",其中前两位为透明度,后六位颜色。 Java代码 View v = findViewById(R....
  • 这类颜色代码用八位十六进制数字表示,其中前两位是指颜色的透明度,后六位是颜色的RGB值(可以用网页应用直接看) 而透明度的换算方法如下: 比如在第一行的颜色中,前两位是"FF",ff就是透明度,ff是16进制换成...
  • 颜色代码 颜色函数 直接输入颜色英文 如:red (严禁在开发中使用) 如#000000 如rgb(0,0,0) #000000 该位数为16进制形式 00-ff 每两代表光学三原色的饱和程度 函数中的三个参数为0-255 256进制 00-r-...
  • 而#开头的(或三)位十六进制数是在设计领域(如CSS以及一些绘图软件)中颜色代码的表示方法。如果我们只考虑24位颜色的话,电脑中每个像素的颜色其实就是用3个字节(24位)的无符号整数来存储的。所以用0x开头的...

空空如也

空空如也

1 2 3 4 5 ... 12
收藏数 234
精华内容 93
关键字:

六位颜色代码