A simple C program that allows users to select a pixel on the screen and retrieve its color information on Linux using Xorg.
- Allows users to drag the mouse and select a pixel on the screen
- Retrieves the color information of the selected pixel
- Displays the color in RGB and HEX formats
- Can be installed globally for easy access from anywhere in the terminal
- Linux operating system with Xorg
- GCC compiler
- Xlib library
-
Clone the repository:
git clone https://github.com/yourusername/color-picker.git
-
Navigate to the project directory:
cd color-picker
-
Install the necessary dependencies. On Ubuntu or Debian-based systems, run:
sudo apt install libx11-dev
On Arch-based systems, run:
sudo pacman -S libx11
-
Build the program:
make
-
Install the program globally:
sudo make install
This will copy the compiled binary to /usr/local/bin, allowing you to run the program from anywhere in the terminal.
-
Run the program from anywhere in the terminal:
whichcolor
-
The program will grab the mouse pointer. Drag the mouse to the desired pixel on the screen.
-
Click the left mouse button to select the pixel.
-
The program will display the color information for the selected pixel, including RGB values and HEX code.
-
To copy the HEX code to the clipboard, run the program with the -c option:
whichcolor -c
To uninstall the program, navigate to the project directory and run:
sudo make uninstall
This will remove the program from /usr/local/bin.
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and commit them with descriptive commit messages.
- Push your changes to your forked repository.
- Submit a pull request to the main repository.
Please ensure that your code follows the project's coding style and conventions.
This project is licensed under the MIT License.
- Xlib - The X Window System library used in this project.
- GCC - The GNU Compiler Collection used to compile the program.
If you have any questions, suggestions, or feedback, please feel free to contact the project maintainer:
- Name: Rammah Alensari
- Email: [email protected]
- GitHub: rxmmah