New Plugin: ColorManager

Hey All

This new plugin will show up soon in the official directory. Quite simply, its just displays the default colours in Kanboard.

2 Likes

Good to see that there is activtiy in the plugin development. Thanks!

Is it possible to change or add one of the colors in Kanboard with this plugin?

I’am aiming for “white” as a default color for the tasks (or better: no color).

Cheers, fx

hello, thanks for the comments.

At the moment, this plugin just displays the default colours as they were not really properly shown anywhere except as text dropdowns.

I needed this default colour list for the TagManager plugin as that uses the colours also. I have a custom css file for all my tags with different colours away from the default. Basically I am trying to work with the default and new colours. So it is a work in progress as the kanboard docs are the biggest probable reason that people dont develop new plugins.

White? difficult to display but ‘no color’ already exists… if you want, I can alter my plugin to dictate no colour instead of blank. Let me look into it. BUt ou of curiousity, why would you want white task/tag colour on a white screen page?

TagManager plugin (colours)

1 Like

Sounds good to me. And now i understand what you are aiming for.

Well, i need (white / no color) for a task because i’am working on a theme (i will release that once i’am fine with it). In that theme the task will not have a complete background color. The color ist only on one side of the border of a task. And i would like to choose “no color” in the drop down menu when creating or editing the task basic informations.

At the moment i simply override “gray” with “white” in the css of the Theme (how ugly). I fear that a change of that drop down list requires changes to the core… i don’t know.

Cheers, fx

There is a hook, you can add colors there:

1 Like

Thanks creecros!

You mean i can “simply” write a smal PlugIn to archieve to add one ore more colors?

Well, i have to dive deeper into that. I’am not bad in programming, but i’am not used to PHP or the details of KanBoard PlugIn development.

Anyway, thanks for that hint. I will have closer look!

Cheers, fx

if you figure out a way do let me know so I can add it to the plugin

i think that was the intent of the hook, but personally, i dont see how that hook does a darn thing. I asked fred in your KB issue regarding colors. maybe he will enlighten us.

maybe it is an oversight or maybe i am missing something:

    public function getList($prepend = false)
    {
        $listing = $prepend ? array('' => t('All colors')) : array();


        foreach ($this->default_colors as $color_id => $color) {
            $listing[$color_id] = t($color['name']);
        }


        $this->hook->reference('model:color:get-list', $listing);


        return $listing;
    }

the return will always be $listing, no matter what we do within the hook. unless there is someway to actually return a variable from the hook that acually is capable of changing the value of $listing.

Never mind I figured it out…i’ll eplain it in a bit.

2 Likes

If you want this in a plugin:
You can alter the list by adding to Plugin.php like so:

        $this->hook->on('model:color:get-list', function (&$listing) {
            $new_colors = array(
                'maroon' => array(
                    'name' => 'Maroon',
                ),);
            $new_list = array();
            foreach ($new_colors as $color_id => $color) {
                $new_list[$color_id] = t($color['name']);
            }
            $listing = array_merge($listing, $new_list);
            return $listing;
        
        });

This will add Maroon to the drop down.
image

BUT, you cannot alter the “default” color list, as it is a protected variable. So the definitions are not buit into the css like the default colors. so you would need to include your own css with the color defintions for Maroon, in this example, or whatever colors you are adding to the list.

You could have this done automatically, by overriding the ColorModel and add your own Custom Colors and include them in the colorCss function, which is “meh” but at least its a plugin.

but it does work:
image

The no plugin method:
you could simply edit the base code and add your custom colors into the protected color list, and there is no need to even use the hook.
Found here:

2 Likes

Awesome :smiley:

This means i can easily add that to my own theme… I hope i will find some time over the upcoming holidays.

Great!

You could have this done automatically, by overriding the ColorModel

just like a template override in plugin.php?

Yes! Very welcome!

Cheers, fx

Quick Update:

  • Big thanks to @creecros for advancing this plugin

Coming up in v2…

  • KBColours becomes ColorManager (reinstall will be most likely required)
  • add/delete custom colours
  • Extra palette with text colors aimed at tags

Its not quite ready for v2 yet though… few more days…

1 Like

Looks great! Can’t wait to test it

1 Like

Released v2

2 Likes

I will check that out as soon as possible!

Great!

1 Like

Released v3.1

1 Like