OpenLink Software

Usage stats on USERAPI HexToRGB

 Permalink

an Entity in Data Space: 134.155.108.49:8890

Takes a hex string (must be 3 or 6 chars long!) and converts it to a RGB set (0-255). If hex is invalid, return black (0,0,0). local function HexToRGB(hex) local rhex, ghex, bhex if strlen(hex) == 6 then rhex, ghex, bhex = strmatch('([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})', hex) elseif strlen(hex) == 3 then rhex, ghex, bhex = strmatch('([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])', hex) if rhex and ghex and bhex then rhex = rhex .. rhex ghex = ghex .. ghex bhex = bhex .. bhex end end if not (rhex and ghex and bhex) then return 0, 0, 0 else return tonumber(rhex, 16), tonumber(ghex, 16), tonumber(bhex, 16) end end

Graph IRICount
http://dbkwik.webdatacommons.org4
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] This material is Open Knowledge Creative Commons License Valid XHTML + RDFa
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Copyright © 2009-2012 OpenLink Software