Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/wolfpld/tracy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorBartosz Taudul <wolf.pld@gmail.com>2018-07-04 19:26:57 +0300
committerBartosz Taudul <wolf.pld@gmail.com>2018-07-04 19:26:57 +0300
commite87abfa7bc3642a59045ab9e9a24fe296b66abd6 (patch)
tree850eed75fe88434319d7fc8a9e0b582b7fbdc316 /extra
parentca0053d4d48239dd13e27c68ec39b17b8d2bc33f (diff)
X11 colors conversion program.
Diffstat (limited to 'extra')
-rw-r--r--extra/x11_colors.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/extra/x11_colors.c b/extra/x11_colors.c
new file mode 100644
index 00000000..f3e20783
--- /dev/null
+++ b/extra/x11_colors.c
@@ -0,0 +1,42 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+int main()
+{
+ FILE* f = fopen( "rgb.txt", "rb" );
+
+ char buf[1024];
+ int off = 0;
+ for(;;)
+ {
+ int sz = fread( buf+off, 1, 1, f );
+ if( buf[off] == '\r' || buf[off] == '\n' || sz == 0 )
+ {
+ if( off == 0 )
+ {
+ if( sz == 0 ) break;
+ continue;
+ }
+ int ok = 1;
+ for( int i=13; i<off; i++ )
+ {
+ if( buf[i] == ' ' ) ok = 0;
+ }
+ if( ok == 1 )
+ {
+ buf[off] = '\0';
+ int r, g, b;
+ sscanf( buf, "%i %i %i", &r, &g, &b );
+ printf( "%s = 0x%02x%02x%02x,\n", buf+13, r, g, b );
+ }
+ off = 0;
+ }
+ else
+ {
+ off++;
+ }
+ if( sz == 0 ) break;
+ }
+
+ fclose( f );
+}