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

//@version=5

// @description TODO: add library description here
library("ThemeLibrary", false)

// @function : a library of themed colors
// @param _theme : the theme color to fetch
// @returns : an array of colors
export theme(string _theme = "Rainbow") =>
	var color[] v = array.new_color(na) 
	v := switch _theme
		'Rainbow' =>
			array.push(v, color.new(#00ff00, 48))
			array.push(v, color.new(#33ff00, 46))
			array.push(v, color.new(#66ff00, 44))
			array.push(v, color.new(#99ff00, 42))
			array.push(v, color.new(#ccff00, 40))
			array.push(v, color.new(#e3dc00, 38))
			array.push(v, color.new(#f4b600, 36))
			array.push(v, color.new(#fe8d00, 34))
			array.push(v, color.new(#ff5d00, 32))
			array.push(v, color.new(#ff0000, 30))
			v
		'Green' =>
			array.push(v, color.new(#a0ffa0, 48)) 
			array.push(v, color.new(#8eff8e, 46)) 
			array.push(v, color.new(#7cff7c, 44)) 
			array.push(v, color.new(#6bff6b, 42)) 
			array.push(v, color.new(#59ff59, 40)) 
			array.push(v, color.new(#47ff47, 38)) 
			array.push(v, color.new(#35ff35, 36)) 
			array.push(v, color.new(#24ff24, 34)) 
			array.push(v, color.new(#12ff12, 32)) 
			array.push(v, color.new(#00ff00, 30))
			v
		'Blue' =>	
			array.push(v, color.new(#a1e3ff, 48)) 
			array.push(v, color.new(#8fdeff, 46)) 
			array.push(v, color.new(#7dd9ff, 44)) 
			array.push(v, color.new(#6bd3ff, 42)) 
			array.push(v, color.new(#59ceff, 40)) 
			array.push(v, color.new(#48c9ff, 38)) 
			array.push(v, color.new(#36c4ff, 36)) 
			array.push(v, color.new(#24beff, 34)) 
			array.push(v, color.new(#12b9ff, 32)) 
			array.push(v, color.new(#00b4ff, 30)) 
			v
		'Red' =>
			array.push(v, color.new(#ffa1a1, 48)) 
			array.push(v, color.new(#ff8f8f, 46)) 
			array.push(v, color.new(#ff7d7d, 44)) 
			array.push(v, color.new(#ff6b6b, 42)) 
			array.push(v, color.new(#ff5959, 40)) 
			array.push(v, color.new(#ff4848, 38)) 
			array.push(v, color.new(#ff3636, 36)) 
			array.push(v, color.new(#ff2424, 34)) 
			array.push(v, color.new(#ff1212, 32)) 
			array.push(v, color.new(#ff0000, 30))
			v
		=>
			na


//====================
i_theme = input.string(defval='Rainbow', title='Choose theme', options=['Rainbow', 'Green', 'Blue', 'Red'])
var color[] colors = theme(i_theme)
plot(0, color=array.get(colors, 0), linewidth = 4)
plot(1, color=array.get(colors, 1), linewidth = 4)
plot(2, color=array.get(colors, 2), linewidth = 4)
plot(3, color=array.get(colors, 3), linewidth = 4)
plot(4, color=array.get(colors, 4), linewidth = 4)
plot(5, color=array.get(colors, 5), linewidth = 4)
plot(6, color=array.get(colors, 6), linewidth = 4)
plot(7, color=array.get(colors, 7), linewidth = 4)
plot(8, color=array.get(colors, 8), linewidth = 4)
plot(9, color=array.get(colors, 9), linewidth = 4)