For faster navigation, this Iframe is preloading the Wikiwand page for Module:Dièse couleur web.

Module:Dièse couleur web

 Documentation[voir] [modifier] [historique] [purger]

Ce module Lua est utilisé par le modèle ((Dièse couleur web)).

Voir les statistiques d'utilisation du module sur l'outil wstat.

-- http://lua-users.org/wiki/StringTrim
local function trim( s )
    return s:match( '^()%s*$' ) and '' or s:match( '^%s*(.*%S)' )
end

local p = {}

function p.couleur( value, echappe )
    if echappe == nil then
        echappe = false
    end
    if value:sub( 1, 1 ) == '#' then
        -- déjà un code hexadécimal précédé du "#"
        if echappe then
            return '#' .. value:sub( 2 )
        else
            return value
        end
    elseif ( #value == 6 or #value == 3 or #value == 8 or #value == 4 ) and value:match( '^%x+$' ) then
        -- code hexadécimal auquel on ajoute le "#" manquant
        if echappe then
            return '#' .. value
        else
            return '#' .. value
        end
    else
        -- nom de couleur HTML
        return value
    end
end

function p.main( frame )
    local value = trim( frame.args[ 1 ] )
    -- paramètre "echappe" à true,
    -- pour échappement de l'éventuel "#" en début de résultat, en raison de [[phab:T14974]]
    return p.couleur( value, true )
end

return p
{{bottomLinkPreText}} {{bottomLinkText}}
Module:Dièse couleur web
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.