-rgba_color parse_color( char *color )
-{
- rgba_color result = { 0xff, 0xff, 0xff, 0xff };
-
- if ( strchr( color, '/' ) )
- color = strrchr( color, '/' ) + 1;
-
- if ( !strncmp( color, "0x", 2 ) )
- {
- unsigned int temp = 0;
- sscanf( color + 2, "%x", &temp );
- result.r = ( temp >> 24 ) & 0xff;
- result.g = ( temp >> 16 ) & 0xff;
- result.b = ( temp >> 8 ) & 0xff;
- result.a = ( temp ) & 0xff;
- }
- else if ( !strcmp( color, "red" ) )
- {
- result.r = 0xff;
- result.g = 0x00;
- result.b = 0x00;
- }
- else if ( !strcmp( color, "green" ) )
- {
- result.r = 0x00;
- result.g = 0xff;
- result.b = 0x00;
- }
- else if ( !strcmp( color, "blue" ) )
- {
- result.r = 0x00;
- result.g = 0x00;
- result.b = 0xff;
- }
- else if ( strcmp( color, "white" ) )
- {
- unsigned int temp = 0;
- sscanf( color, "%d", &temp );
- result.r = ( temp >> 24 ) & 0xff;
- result.g = ( temp >> 16 ) & 0xff;
- result.b = ( temp >> 8 ) & 0xff;
- result.a = ( temp ) & 0xff;
- }
-
- return result;
-}
-