[vlc-commits] misc: vlc_html_color: add [a]rgb()
Francois Cartegnie
git at videolan.org
Tue Feb 14 17:51:00 CET 2017
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Feb 14 17:26:39 2017 +0100| [64e3353220df73dd4ceede1de558010d402ae8bb] | committer: Francois Cartegnie
misc: vlc_html_color: add [a]rgb()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=64e3353220df73dd4ceede1de558010d402ae8bb
---
src/misc/text_style.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/misc/text_style.c b/src/misc/text_style.c
index 270db92..9f0d0e1 100644
--- a/src/misc/text_style.c
+++ b/src/misc/text_style.c
@@ -260,6 +260,17 @@ unsigned int vlc_html_color( const char *psz_value, bool* ok )
}
}
+ if( !b_ret && psz_hex == psz_value &&
+ !strncmp( "rgb", psz_value, 3 ) )
+ {
+ unsigned r,g,b,a = 0xFF;
+ if( psz_value[3] == 'a' )
+ b_ret = (sscanf( psz_value, "rgba(%3u,%3u,%3u,%3u)", &r, &g, &b, &a ) == 4);
+ else
+ b_ret = (sscanf( psz_value, "rgb(%3u,%3u,%3u)", &r, &g, &b ) == 3);
+ color = (a << 24) | (r << 16) | (g << 8) | b;
+ }
+
if( !b_ret && psz_hex == psz_value )
{
for( int i = 0; p_html_colors[i].psz_name != NULL; i++ )
More information about the vlc-commits
mailing list