Mbxcolors - pick, paste and organize colors (palettes)

mbxcolors is a menu to pick, paste and organize colors (palettes).

Click color to paste it’s code in place of cursor.

Features:

  • pick color from screen (color preview is available in bottom left corner of screen)
  • 2 actions
    – paste - (default) type color code in place of cursor
    – copy - copy color code to clipboard
  • 3 formats: hexadecimal (default), RGB and RGBa
  • create color palettes from picked colors
  • 2 example palettes available by default
  • HTML colors
  • type to search - usefull for searching HTML colors by name

Installation (from Mabox repo)

yay -S mbxcolors

This utility is intended to run from keyboard shortcut or panel button.
Configure keyboard shortcut by using obkey or editing ~/.config/openbox/rc.xml

Here we configure super + c to run mbxcolors and change Compton toggle to super + p . It will be configured like that in upcoming Mabox ISO release.

<keybind key="W-c">
      <action name="Execute">
        <command>mbxcolors</command>
      </action>
</keybind>
<keybind key="W-p">
      <action name="Execute">
        <command>compton_toggle</command>
      </action>
</keybind>

(optional) Add button to tint2 panel:

More screenshots:


This utility is not Openbox nor Mabox specific, so you can install and test it in any Arch based distro and X11 based WM or DE. I tested it briefly with XFCE and LXDE.
Package is currently available in Mabox repo

This is early version and any feedback welcome :slight_smile:

1 Like

So I’m a color picker/palette/organizer/mixer junkie. This is one of the coolest tools I’ve seen in a lightweight DE!

One thing, unless it is there and I am missing it: how difficult would it be to add a color wheel picker, so that we could create new colors without getting them onto the desktop to pick up with the dropper?

Nothing fancy: something similar to gcolor3 (shown below)? Or a menu to bring up a color chooser. If I can figure out how to add that myself, I will–and will share, of course. I haven’t looked closely enough at mbxcolors to know what it is made of yet.

Glad to hear that this helper is useful to someone, not just me.
This is just a bash script that glues jgmenu and colorpicker together and adds some simple logic. So don’t have too high expectations;)
I often pick up colors from specialized websites.

I think I can just add a detection if other color tools are installed (like gpick, gcolor3) and add their activation to the menu.
Then you will simply be able to run these programs and pick the needed color from them to your palette.
Do you think that would be useful?

A note for me: there is also nice little picker GitHub - Soft/xcolor: Lightweight color picker for X11 which may be worth to integrate in mbxcolors

I’m a very amateur coder, so the lower the expectations, the better. :slight_smile:
I was hoping it was some extension of jgmenu–I’ve successfully done things with it before!

That would be useful for me, certainly!

The Qt toolkit includes a simple color picker and Mabox includes the dependencies by default.

Here’s a simple python script that implements it:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *


class App(QMainWindow):
    def __init__(self):
        super(self.__class__, self).__init__()
        QColorDialog.getColor()
        self.exitapplication()

    def exitapplication(self):  # Exit point
        self.close()
        sys.exit()


if __name__ == "__main__":
    app = QApplication(sys.argv)
    ex = App()

colour-picker1

If you want to theme it change the last line to:

    app = QApplication(sys.argv)
    palette = QPalette()
    palette.setColor(QPalette.Window, QColor(34, 43, 46))
    palette.setColor(QPalette.WindowText, QColor(Qt.white))
    palette.setColor(QPalette.Base, QColor(38, 48, 52))
    palette.setColor(QPalette.AlternateBase, QColor(34, 43, 46))
    palette.setColor(QPalette.ToolTipBase, Qt.white)
    palette.setColor(QPalette.ToolTipText, Qt.white)
    palette.setColor(QPalette.Text, Qt.white)
    palette.setColor(QPalette.Button, QColor(34, 43, 46))
    palette.setColor(QPalette.ButtonText, Qt.white)
    palette.setColor(QPalette.BrightText, Qt.red)
    palette.setColor(QPalette.Link, QColor(42, 130, 218))
    palette.setColor(QPalette.Highlight, QColor(42, 130, 218))
    palette.setColor(QPalette.HighlightedText, Qt.black)
    app.setPalette(palette)
    ex = App()

And play around with the color values.
colour-picker2

Hope this is of some use :slight_smile:

3 Likes

Spent some time today on mbxcolors … and I’m really unhappy that I released it to the public too early.
I should have been testing it and improving it for a few more weeks.
Anyway, this is a beta quality tool at the moment, and you are unintentionally beta testers … sorry.

My to-do list with mbxcolors:

  • speed, speed, speed … at the moment it will become slow like a turtle when you create just a few color palettes,
  • add xcolor as picker,
  • add detection of gpick, gcolor and other similiar tools,
  • add export palette to GIMP format (.gpl - used also by Inkscape)
  • test, test, test… before release something next time:)

Those changes will take some time… and unfortunately update will probably require some manual interventions to ~/.config/mbxcolors dir :frowning:

On the other hand, something optimistic … there is a chance that mbxcolors and someday also other mabox-tools will work on any X11 based environment :slight_smile:

Here are screenshots from the Manjaro KDE tests, but what I really want to do is to bring them to some now forgotten and great lightweight window managers like Fluxbox, IceWM etc.

1 Like

I don’t mind being a beta tester for this sort of thing: a new and useful tool that will only get better. :slight_smile:

That said, I’m dealing with a number of other “life issues”, so I may or may not always be prompt with suggestions/bug reports. But I’m fine with using this in whatever iteration it is currently in, to see what might become of it and help when I can.

1 Like

Updated version 0.1.6 is available :slight_smile:

  • speed improvements - it is much faster and comfortable now
  • separate self made palettes from built-in
  • easy delete colors from picked
  • use xcolor as picker

@piquet I will look how to include some kind of color selector, this one from PyQt or other :slight_smile:
I don’t want to add more hard dependencies, rather detect what is installed and make use of it. I want this utility to be more universal, not for Mabox only.

Do we have any Python expert here?
@sng:wink:
I’m trying to execute a few lines of Python code from a Bash script …
Seems to be working…
But I don’t know if I’m doing it right.

#!/bin/bash
pycolor() {
    read -r -d '' script <<-"----EOF"
        import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *

class App(QMainWindow):
    def __init__(self):
        super(self.__class__, self).__init__()
        color = QColorDialog.getColor()
        print(color.name())
        self.exitapplication()

    def exitapplication(self):  # Exit point
        self.close()
        sys.exit()

if __name__ == "__main__":
    app = QApplication(sys.argv)
    ex = App()
----EOF
    python -c "$script"
}
color=$(pycolor)
echo "${color}"
1 Like

Well, I’m no GUI python expert, but just a couple of things…

#!/bin/bash
pycolor() {
    read -r -d '' script <<-"----EOF"
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow, QColorDialog

class App(QMainWindow):
    def __init__(self):
        super().__init__()
        color = QColorDialog.getColor()
        if color.isValid():
            print(color.name())
        self.deleteLater()

if __name__ == "__main__":
    app = QApplication(sys.argv)
    win = App()
----EOF
    python -c "$script"
}
color=$(pycolor)
echo "${color}"


This way if I cancel it, I get nothing, so a [ -z "${color}" ] will catch that

1 Like

PyQt5 is not installed by default in Mabox.
Yad have color picker also:

yad --color

but seems it sometimes returns other color than you selected :crazy_face: :angry:

Just released and pushed 0.2.0 version.
Uses gcolor3 as color selector and xcolor for picking pixel color from screen.
I think/hope it is not bad at current state :wink: