Coder Social home page Coder Social logo

feat: Assign labels a color about git-bug HOT 13 OPEN

michaelmure avatar michaelmure commented on June 27, 2024 4
feat: Assign labels a color

from git-bug.

Comments (13)

MichaelMure avatar MichaelMure commented on June 27, 2024 1

@j-f1 Thanks

More info on the subject: https://gist.github.com/XVilka/8346728

I found a go implementation: https://github.com/xo/terminfo/blob/master/color.go#L49-L91

from git-bug.

vtexier avatar vtexier commented on June 27, 2024 1

My git-bug choose the same color for two labels on a total of three labels!

Capture du 2020-11-12 17-10-42

A silly idea: replace or add to colors a special character symbol.

Color blind people, and others could distinguish issues more easily...

from git-bug.

MichaelMure avatar MichaelMure commented on June 27, 2024

My thought on this:

  • the good end game way to have properly defined colors for each label would be to have a git-bug config where admins could define various properties including what label exist and their colors, define what status exist for a bug and how you can transition from one status to another ... but we are not there yet
  • there is already in the webUI some code to assign arbitrary colors to a label (https://github.com/MichaelMure/git-bug/blob/master/webui/src/Label.js#L10-L43)

My proposal:

  1. migrate the webui color code into the core. That way, a label will have the same color in all UIs, will get simpler and the core APIs will be ready for the end game
  2. when we have the code to define the config, we will just have to plug that in the core and we will have either automatic label colors or configured labels if users care enough to define them.

from git-bug.

j-f1 avatar j-f1 commented on June 27, 2024

For the termui, there needs to be a fallback for the colors since some terminals only support 16 or 256 colors.

from git-bug.

MichaelMure avatar MichaelMure commented on June 27, 2024

@j-f1 good point. That should be fairly easy to reduce the color precision to 16 or 8bits. I'm a bit confused as to how one is supposed to detect the terminal capabilities. I have the same question for how to detect the terminal size btw.

from git-bug.

j-f1 avatar j-f1 commented on June 27, 2024

Here’s a series of checks (in JavaScript, from the supports-color module) that determine the level of color support. Please @mention me if you have any questions about what it’s doing:

if (env.COLORTERM === 'truecolor') {
  return 3;
}


if ('TERM_PROGRAM' in env) {
  const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);


  switch (env.TERM_PROGRAM) {
    case 'iTerm.app':
      return version >= 3 ? 3 : 2;
    case 'Apple_Terminal':
      return 2;
    // No default
  }
}


if (/-256(color)?$/i.test(env.TERM)) {
  return 2;
}


if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
  return 1;
}


if ('COLORTERM' in env) {
  return 1;
}


if (env.TERM === 'dumb') {
  return min;
}

source

from git-bug.

MichaelMure avatar MichaelMure commented on June 27, 2024

Label's color are now defined directly in the core and used in the webUI through the graphQL API.

Next steps are:

  • display the label's color in the termui
  • make the colors configurable

from git-bug.

MichaelMure avatar MichaelMure commented on June 27, 2024

Code used by Github's hub command to display labels: https://github.com/github/hub/blob/master/utils/color.go

image

from git-bug.

kondanta avatar kondanta commented on June 27, 2024

Mind if I ask the current state of this issue?

from git-bug.

MichaelMure avatar MichaelMure commented on June 27, 2024

Labels should be displayed everywhere with the correct color, but you can't choose the color yourself. That would require a proper configuration data structured stored in git and shared.

from git-bug.

kondanta avatar kondanta commented on June 27, 2024

Alright, I understand. Do you planning to support colour selection in near future?

from git-bug.

MichaelMure avatar MichaelMure commented on June 27, 2024

Probably not as there is some significant development with higher priority (some being required to implement that feature).

from git-bug.

dllud avatar dllud commented on June 27, 2024

I second @vtexier. On the CLI and TUI, displaying a (coloured) character (e.g. the first letter of the label) would be much more useful than the current square.

I just created 2 labels on a repo and git-bug chose exactly the same colour for them.

from git-bug.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.