Sponsored Content
Top Forums Shell Programming and Scripting awk (or) UNIX random RGB colors generator? Post 302982019 by Corona688 on Thursday 22nd of September 2016 12:58:14 PM
Old 09-22-2016
Code:
$ printf "%02x%02x%02x\n" $((RANDOM%256)) $((RANDOM%256)) $((RANDOM%256))
2ae9ae

$

These 2 Users Gave Thanks to Corona688 For This Post:
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to make VI editor show colors in Unix

Hi, I saw some people's vi editor show different colors on the text according the nature of text when using it. It would be nice if I can see diffrerent colors with my vi editor. Do anybody know how to set it up? I use PowerTermPro program to access unix machine. I tried to use vim editor but... (7 Replies)
Discussion started by: whatisthis
7 Replies

2. UNIX for Advanced & Expert Users

How to create & use a personal rgb.txt

Greetings -- I'm curious as to an effective way for a user (not root) to set-up a supplemental rgb.txt file for personal use on an X11 system. It's easy to set up the rgb.txt file (with only new colors) in my directory, but how can I use it in addition to the standard rgb.txt file. Thanks.... (0 Replies)
Discussion started by: slapshot_paulie
0 Replies

3. Programming

Xlib - Mapping Pixel Values to RGB Colors

Hi everyone... I'm working with XLib and I want to find out the pixel value of a particular point on screen and then map it to RGB values. I used XGetImage and XGetPixel to get the pixel value, but how do I get the RGB values of the pixel? I went through a few XLib manuals, there seems to be no... (1 Reply)
Discussion started by: thebin
1 Replies

4. Solaris

Does Solaris have a random number generator?

I am trying to find a way to generate random numbers within a shell script. Does Solaris have a utility that will generate random numbers? Thanks in advance. B (3 Replies)
Discussion started by: one_ring99
3 Replies

5. Shell Programming and Scripting

awk, shell script reverse engineering app generator - project

Hi, this is fantastic forum for shell programming and scripting, so please let me to introduce you with my very old concept to have web form/s with radio, select, input fields and have an application generating valid, syntax error free scripting code. The same or alike questions are asked... (2 Replies)
Discussion started by: darius2
2 Replies

6. Shell Programming and Scripting

Random Sentence Generator

Hi, I need to create a table with random sentences. I need lines that are upto 1000 characters in lenght. I need a random sentence generator that will create sentences and output it to a text file. The sentences should be of lenght varying from 1 to 1000. Does anyone know how this can be... (7 Replies)
Discussion started by: kaushys
7 Replies

7. Shell Programming and Scripting

Need specialized random string generator script

Hi, I need a script that will generate a set of random strings in sequence, with the ability to predetermine the length, quantity, and alphabet of individual string, and to use the outputs of earlier strings in the sequence to define the parameters of later strings. For examples, I might want... (5 Replies)
Discussion started by: vajrajames
5 Replies

8. UNIX for Dummies Questions & Answers

A crude random byte generator...

There was an upload recently on generating a pseudo-random file when /dev/random does NOT exist. This does not need /dev/random, /dev/urandom or $RANDOM either... (I assume $RANDOM relies on the /dev/random device in some way.) This code uses hexdump just because I like hexdump for ease of... (2 Replies)
Discussion started by: wisecracker
2 Replies

9. Shell Programming and Scripting

Random Password generator with 2 digits and 6 characters

I am using the below to random generate a password but I need to have 2 numeric characters and 6 alphabetic chars head /dev/urandom | tr -dc A-Za-z0-9 | head -c 8 ; echo '' 6USUvqRB ------ Post updated at 04:43 PM ------ Any Help folks - Can the output be passed onto a sed command to... (9 Replies)
Discussion started by: infernalhell
9 Replies
XLookupColor()															    XLookupColor()

Name
  XLookupColor - get database RGB values and closest hardware-supported RGB values from color name.

Synopsis
  Status XLookupColor(display, colormap, colorname, exact_def_return, screen_def_return)
	Display *display;
	Colormap colormap;
	char *colorname;
	XColor *exact_def_return, *screen_def_return;

Arguments
  display     Specifies a connection to an X server; returned from XOpenDisplay().

  colormap    Specifies the colormap.

  colorname   Specifies  a  color  name string (for example "red").  Uppercase or lowercase does not matter.  If the color name is not in the
	      Host Portable Character Encoding, the result is implementation-dependent.

  exact_def_return
	      Returns the exact RGB values for the specified color name from the /usr/lib/X11/rgb database.

  screen_def_return
	      Returns the closest RGB values possible on the hardware.

Returns
  Zero on failure, non-zero on success.

Description
  XLookupColor() looks up RGB values for a color given the colorname string.  It returns both the exact color values and the  closest  values
  possible on tthe screen specified by colormap.

  XLookupColor() returns non-zero if colorname exists in the RGB database or zero if it does not exist.

  To  determine  the  exact RGB values, XLookupColor() uses a database on the X server.  On UNIX, this database is /usr/lib/X11/rgb.  To read
  the colors provided by the database on a UNIX-based system, see /usr/lib/X11/rgb.txt.  The location, name, and contents of  this  file  are
  server-dependent.

  For more information see Volume One, Chapter 7, Color, and Appendix D, The Server-side Color Database, in this volume.

Errors
  BadName   Color name not in database.

  BadColor  Invalid colormap.

Structures
     typedef struct {
	 unsigned long pixel;
	 unsigned short red, green, blue;
	 char flags;	    /* DoRed, DoGreen, DoBlue */
	 char pad;
     } XColor;

See Also
  XBlackPixel(),  XWhitePixel(),  XAllocColor(),  XAllocColorCells(),  XAllocColorPlanes(), XAllocNamedColor(), XFreeColors(), XParseColor(),
  XQueryColor(), XQueryColors(), XStoreColor(), XStoreColors(), XStoreNamedColor().

Xlib - Color Cells														    XLookupColor()
All times are GMT -4. The time now is 10:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy