extends RefCounted # Shared nine-slice stone, silver filigree and parchment surfaces. static func texture_style(texture,padding=18,border=24): var s=StyleBoxTexture.new();s.texture=texture for side in [SIDE_LEFT,SIDE_TOP,SIDE_RIGHT,SIDE_BOTTOM]: s.set_texture_margin(side,border);s.set_content_margin(side,padding) return s static func panel(parchment=false,padding=24): return texture_style(preload("res://art/ui/parchment_panel.svg") if parchment else preload("res://art/ui/stone_panel.svg"),padding,38) static func button(state="normal",parchment=false): var texture=preload("res://art/ui/stone_button.svg") if parchment:texture=preload("res://art/ui/parchment_hover.svg") if state=="hover" else preload("res://art/ui/parchment_button.svg") elif state=="hover" or state=="pressed":texture=preload("res://art/ui/stone_hover.svg") elif state=="disabled":texture=preload("res://art/ui/stone_disabled.svg") var s=texture_style(texture,12,30) s.content_margin_top=10;s.content_margin_bottom=10 return s static func apply_button(b,parchment=false): for state in ["normal","hover","pressed","disabled"]:b.add_theme_stylebox_override(state,button(state,parchment)) b.add_theme_color_override("font_color",Color("292e2c") if parchment else Color("deddd0")) b.add_theme_color_override("font_focus_color",Color("292e2c") if parchment else Color("deddd0")) b.add_theme_color_override("font_hover_color",Color("131a18") if parchment else Color("fff9e7")) b.add_theme_color_override("font_pressed_color",Color("161d1a") if parchment else Color("e9e3d3")) b.add_theme_color_override("font_disabled_color",Color("777d77")) var focus=StyleBoxFlat.new();focus.bg_color=Color.TRANSPARENT;focus.border_color=Color("b9c9c0");focus.set_border_width_all(1);focus.set_corner_radius_all(5) b.add_theme_stylebox_override("focus",focus) static func icon(state="normal"): var s=StyleBoxFlat.new();s.bg_color=Color("1b2425") if state!="hover" else Color("394446") s.border_color=Color("929f98") if state!="pressed" else Color("d9e0cc");s.set_border_width_all(2);s.set_corner_radius_all(5) s.shadow_color=Color(0,0,0,.6);s.shadow_size=3 for side in [SIDE_LEFT,SIDE_TOP,SIDE_RIGHT,SIDE_BOTTOM]:s.set_content_margin(side,5) return s static func apply_slider(slider): var track=StyleBoxFlat.new();track.bg_color=Color("111a19");track.border_color=Color("6a7971");track.set_border_width_all(1);track.set_corner_radius_all(2);track.content_margin_top=4;track.content_margin_bottom=4 var fill=track.duplicate();fill.bg_color=Color("81938b");fill.border_color=Color("a9b5a7") slider.add_theme_stylebox_override("slider",track);slider.add_theme_stylebox_override("grabber_area",fill);slider.add_theme_stylebox_override("grabber_area_highlight",fill) for state in ["grabber","grabber_highlight","grabber_disabled"]:slider.add_theme_icon_override(state,preload("res://art/ui/slider_knob.svg")) static func apply_check(check): for state in ["checked","checked_disabled"]:check.add_theme_icon_override(state,preload("res://art/ui/check_on.svg")) for state in ["unchecked","unchecked_disabled"]:check.add_theme_icon_override(state,preload("res://art/ui/check_off.svg")) static func apply_scroll(scroll): var bar=scroll.get_v_scroll_bar() var track=StyleBoxFlat.new();track.bg_color=Color("111918");track.content_margin_left=4;track.content_margin_right=4 var grabber=StyleBoxFlat.new();grabber.bg_color=Color("606e67");grabber.border_color=Color("a3aea2");grabber.set_border_width_all(1);grabber.set_corner_radius_all(3);grabber.content_margin_top=12;grabber.content_margin_bottom=12 bar.add_theme_stylebox_override("scroll",track) for state in ["grabber","grabber_highlight","grabber_pressed"]:bar.add_theme_stylebox_override(state,grabber)