Skip to content

Commit 5e5c044

Browse files
committed
Add helper functions to return color values
1 parent a025bd5 commit 5e5c044

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

‎helpers.php‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,43 @@ function settings($key = null)
5050
}
5151
}
5252

53+
if (!function_exists('default_color')) {
54+
/**
55+
* Returns the default color value.
56+
*
57+
* @param $key
58+
*
59+
* @return string
60+
*/
61+
function default_color($key)
62+
{
63+
return config('app.default_colors.' . $key);
64+
}
65+
}
66+
67+
if (!function_exists('color')) {
68+
/**
69+
* Returns the color value from the settings.
70+
*
71+
* @param $key
72+
*
73+
* @return string
74+
*/
75+
function color($key)
76+
{
77+
if ($colors = config('css-override.variables')) {
78+
$colors = json_decode($colors);
79+
foreach ($colors as $color) {
80+
if ($color->id === '$' . $key) {
81+
return $color->value;
82+
}
83+
}
84+
}
85+
86+
return default_color($key);
87+
}
88+
}
89+
5390
if (!function_exists('refresh_artisan_caches')) {
5491
/**
5592
* Re-caches artisan config, routes, and/or events when they are already cached.

0 commit comments

Comments
 (0)