Colors
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © gliderfund

//@version=5

// @description This Library delivers Hex Codes of Colors frequently used in indicators and strategies.
library("Colors", overlay = true)


// @function          Collection: Pinescript v3 Colors.
// @param colorName   Color Name.
// @returns           Hex code of the inquired color.
export v3(simple string colorName) =>
    switch colorName
        'maroon'    => #800000
        'red'       => #FF0000
        'navy'      => #000080
        'blue'      => #0000FF
        'aqua'      => #00FFFF
        'teal'      => #008080
        'green'     => #008000
        'lime'      => #00FF00
        'olive'     => #808000
        'fuchsia'   => #FF00FF
        'purple'    => #800080
        'orange'    => #FF7F00
        'yellow'    => #FFFF00
        'black'     => #000000
        'gray'      => #808080
        'silver'    => #C0C0C0
        'white'     => #FFFFFF
        =>
            runtime.error("No matching color found.")
            color(na)

// End of Function


// @function          Collection: Pinescript v4 Colors.
// @param colorName   Color Name.
// @returns           Hex code of the inquired color.
export v4(simple string colorName) =>
    switch colorName
        'maroon'    => #880E4F
        'red'       => #FF5252
        'navy'      => #311B92
        'blue'      => #2196F3
        'aqua'      => #00BCD4
        'teal'      => #00897B
        'green'     => #4CAF50
        'lime'      => #00E676
        'olive'     => #808000
        'fuchsia'   => #E040FB
        'purple'    => #9C27B0
        'orange'    => #FF9800
        'yellow'    => #FFEB3B
        'black'     => #363A45
        'gray'      => #787B86
        'silver'    => #B2B5BE
        'white'     => #FFFFFF
        =>
            runtime.error("No matching color found.")
            color(na)

// End of Function

// Test
plot(series = close, color = v3('red'))
