acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
_string.h
1// Created by camilo on 2022-10-23 01:38 <3ThomasBorregaardSorensen!!
2#pragma once
3
4
5inline string hex_color(const ::color::color & color)
6{
7
8 string str;
9
10 str.formatf("%02x%02x%02x", color.u8_red(), color.u8_green(), color.u8_blue());
11
12 return str;
13
14}
15
16
17string _hex_color(const ::color::color & color)
18{
19
20 return "#" + ::hex_color(color);
21
22}
23
24
25//string hex_color(const ::hex_color & color)
26//{
27//
28// return ::hex_color(color);
29//
30//}
31//
32
33inline ::string as_string(const ::color::color & color)
34{
35
36 return ::string_formatf("%f %f %f %f", color.f32_red(), color.f32_green(), color.f32_blue(), color.f32_opacity());
37
38}
39
40
41CLASS_DECL_ACME::color::color as_color(const ::scoped_string& scopedstr);
42
43
44inline void from_string(::color::color& color, const ::scoped_string& scopedstr)
45{
46
47 color = ::as_color(scopedstr);
48
49}
50
51
Definition color.h:162