Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. I want set of totally distinct shades of QCOlor around 64
Forum Updated to NodeBB v4.3 + New Features

I want set of totally distinct shades of QCOlor around 64

Scheduled Pinned Locked Moved Unsolved General and Desktop
20 Posts 5 Posters 4.9k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    Qt Enthusiast
    wrote on last edited by
    #4

    If you the see the color pallete in
    https://www.google.co.in/search?q=qcolordialog+color+palette&tbm=isch&imgil=_CijNvFuIaiO2M%253A%253B64sw8dEU0PjblM%253Bhttp%25253A%25252F%25252Fdoc.qt.io%25252Fqt-5%25252Fqcolordialog.html&source=iu&pf=m&fir=CijNvFuIaiO2M%253A%252C64sw8dEU0PjblM%252C&usg=__somCqlmBGeVEFzF6xDyE6ABPRUY%3D&biw=1522&bih=810&ved=0ahUKEwjH1aeb7KvVAhWCFJQKHVaPANYQyjcIQA&ei=ORx7WYfVFIKp0ATWnoKwDQ#imgrc=_CijNvFuIaiO2M:
    then the colors are not distinct .

    I want a distincy colors in this pallete

    1 Reply Last reply
    0
    • yuvaramY Offline
      yuvaramY Offline
      yuvaram
      wrote on last edited by
      #5

      @qtEnthusiast
      Hi,
      Do you want to use different shades of color. Then based on hex value of color, hex value can be set to QColor and can be used.
      link text

      Yuvaram Aligeti
      Embedded Qt Developer
      : )

      1 Reply Last reply
      1
      • Q Offline
        Q Offline
        Qt Enthusiast
        wrote on last edited by Qt Enthusiast
        #6

        No I want a algorithm that gives me different set of colors very different something like this
        https://stackoverflow.com/questions/2328339/how-to-generate-n-different-colors-for-any-natural-number-n

        kshegunovK 1 Reply Last reply
        0
        • Q Qt Enthusiast

          No I want a algorithm that gives me different set of colors very different something like this
          https://stackoverflow.com/questions/2328339/how-to-generate-n-different-colors-for-any-natural-number-n

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by kshegunov
          #7

          Convert the rectangular RGB space into a spherical one and introduce a metric (if you want), then pick the colors from splitting the unit sphere into a number of parallels and meridians. At least that's what I'd do. The math isn't that complicated you can pull the formulas from wikipedia to try and wrap something up.

          Read and abide by the Qt Code of Conduct

          Q 1 Reply Last reply
          2
          • kshegunovK kshegunov

            Convert the rectangular RGB space into a spherical one and introduce a metric (if you want), then pick the colors from splitting the unit sphere into a number of parallels and meridians. At least that's what I'd do. The math isn't that complicated you can pull the formulas from wikipedia to try and wrap something up.

            Q Offline
            Q Offline
            Qt Enthusiast
            wrote on last edited by
            #8

            @kshegunov

            Is it possible to provide the code

            kshegunovK 1 Reply Last reply
            0
            • Q Offline
              Q Offline
              Qt Enthusiast
              wrote on last edited by
              #9

              some pseudo code of rectangles will be done

              1 Reply Last reply
              0
              • Q Qt Enthusiast

                @kshegunov

                Is it possible to provide the code

                kshegunovK Offline
                kshegunovK Offline
                kshegunov
                Moderators
                wrote on last edited by
                #10

                @Qt-Enthusiast said in I want set of totally distinct shades of QCOlor around 64:

                @kshegunov

                Is it possible to provide the code

                Not really, I haven't any code, as I haven't done anything of that sort. It's only an idea you could explore.

                Read and abide by the Qt Code of Conduct

                1 Reply Last reply
                0
                • mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #11

                  alt text

                  1 Reply Last reply
                  0
                  • Q Offline
                    Q Offline
                    Qt Enthusiast
                    wrote on last edited by
                    #12

                    what algortimhs generates this

                    mrjjM 1 Reply Last reply
                    0
                    • Q Qt Enthusiast

                      what algortimhs generates this

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by mrjj
                      #13

                      @Qt-Enthusiast
                      I think its a dictionary.
                      Make a small test program. there is also a table of hex values to use. sample the color from the bitmap. (same offset so not so complex)
                      Then alter properties (QColor) to fine tune.
                      http://godsnotwheregodsnot.blogspot.dk/2013/11/kmeans-color-quantization-seeding.html
                      Kmeans++ Color Quantization seeding it seems :)
                      From
                      https://graphicdesign.stackexchange.com/questions/3682/where-can-i-find-a-large-palette-set-of-contrasting-colors-for-coloring-many-d

                      1 Reply Last reply
                      1
                      • mrjjM Offline
                        mrjjM Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on last edited by mrjj
                        #14

                        Hi
                        Using his table, and some ligher() and darker() calls then they seems pretty distinct ;)

                        alt text

                        #include "mainwindow.h"
                        #include "ui_mainwindow.h"
                        #include <QPainter>
                        
                        MainWindow::MainWindow(QWidget* parent) :
                          QMainWindow(parent),
                          ui(new Ui::MainWindow) {
                          ui->setupUi(this);
                        }
                        
                        MainWindow::~MainWindow() {
                          delete ui;
                        }
                        
                        const char* indexcolors[] = {
                          "#000000", "#FFFF00", "#1CE6FF", "#FF34FF", "#FF4A46", "#008941", "#006FA6", "#A30059",
                          "#FFDBE5", "#7A4900", "#0000A6", "#63FFAC", "#B79762", "#004D43", "#8FB0FF", "#997D87",
                          "#5A0007", "#809693", "#FEFFE6", "#1B4400", "#4FC601", "#3B5DFF", "#4A3B53", "#FF2F80",
                          "#61615A", "#BA0900", "#6B7900", "#00C2A0", "#FFAA92", "#FF90C9", "#B903AA", "#D16100",
                          "#DDEFFF", "#000035", "#7B4F4B", "#A1C299", "#300018", "#0AA6D8", "#013349", "#00846F",
                          "#372101", "#FFB500", "#C2FFED", "#A079BF", "#CC0744", "#C0B9B2", "#C2FF99", "#001E09",
                          "#00489C", "#6F0062", "#0CBD66", "#EEC3FF", "#456D75", "#B77B68", "#7A87A1", "#788D66",
                          "#885578", "#FAD09F", "#FF8A9A", "#D157A0", "#BEC459", "#456648", "#0086ED", "#886F4C",
                        
                          "#34362D", "#B4A8BD", "#00A6AA", "#452C2C", "#636375", "#A3C8C9", "#FF913F", "#938A81",
                          "#575329", "#00FECF", "#B05B6F", "#8CD0FF", "#3B9700", "#04F757", "#C8A1A1", "#1E6E00",
                          "#7900D7", "#A77500", "#6367A9", "#A05837", "#6B002C", "#772600", "#D790FF", "#9B9700",
                          "#549E79", "#FFF69F", "#201625", "#72418F", "#BC23FF", "#99ADC0", "#3A2465", "#922329",
                          "#5B4534", "#FDE8DC", "#404E55", "#0089A3", "#CB7E98", "#A4E804", "#324E72", "#6A3A4C",
                          "#83AB58", "#001C1E", "#D1F7CE", "#004B28", "#C8D0F6", "#A3A489", "#806C66", "#222800",
                          "#BF5650", "#E83000", "#66796D", "#DA007C", "#FF1A59", "#8ADBB4", "#1E0200", "#5B4E51",
                          "#C895C5", "#320033", "#FF6832", "#66E1D3", "#CFCDAC", "#D0AC94", "#7ED379", "#012C58",
                        
                          "#7A7BFF", "#D68E01", "#353339", "#78AFA1", "#FEB2C6", "#75797C", "#837393", "#943A4D",
                          "#B5F4FF", "#D2DCD5", "#9556BD", "#6A714A", "#001325", "#02525F", "#0AA3F7", "#E98176",
                          "#DBD5DD", "#5EBCD1", "#3D4F44", "#7E6405", "#02684E", "#962B75", "#8D8546", "#9695C5",
                          "#E773CE", "#D86A78", "#3E89BE", "#CA834E", "#518A87", "#5B113C", "#55813B", "#E704C4",
                          "#00005F", "#A97399", "#4B8160", "#59738A", "#FF5DA7", "#F7C9BF", "#643127", "#513A01",
                          "#6B94AA", "#51A058", "#A45B02", "#1D1702", "#E20027", "#E7AB63", "#4C6001", "#9C6966",
                          "#64547B", "#97979E", "#006A66", "#391406", "#F4D749", "#0045D2", "#006C31", "#DDB6D0",
                          "#7C6571", "#9FB2A4", "#00D891", "#15A08A", "#BC65E9", "#FFFFFE", "#C6DC99", "#203B3C",
                        
                          "#671190", "#6B3A64", "#F5E1FF", "#FFA0F2", "#CCAA35", "#374527", "#8BB400", "#797868",
                          "#C6005A", "#3B000A", "#C86240", "#29607C", "#402334", "#7D5A44", "#CCB87C", "#B88183",
                          "#AA5199", "#B5D6C3", "#A38469", "#9F94F0", "#A74571", "#B894A6", "#71BB8C", "#00B433",
                          "#789EC9", "#6D80BA", "#953F00", "#5EFF03", "#E4FFFC", "#1BE177", "#BCB1E5", "#76912F",
                          "#003109", "#0060CD", "#D20096", "#895563", "#29201D", "#5B3213", "#A76F42", "#89412E",
                          "#1A3A2A", "#494B5A", "#A88C85", "#F4ABAA", "#A3F3AB", "#00C6C8", "#EA8B66", "#958A9F",
                          "#BDC9D2", "#9FA064", "#BE4700", "#658188", "#83A485", "#453C23", "#47675D", "#3A3F00",
                          "#061203", "#DFFB71", "#868E7E", "#98D058", "#6C8F7D", "#D7BFC2", "#3C3E6E", "#D83D66",
                        
                          "#2F5D9B", "#6C5E46", "#D25B88", "#5B656C", "#00B57F", "#545C46", "#866097", "#365D25",
                          "#252F99", "#00CCFF", "#674E60", "#FC009C", "#92896B"
                        };
                        
                        
                        void MainWindow::on_pbGo_released() {
                          const int tilesize = 32;
                          const int mapsize = tilesize * 25 ;
                          QPixmap pix(QSize(mapsize, mapsize));
                          QPainter Painter;
                        
                          int maxCol = sizeof(indexcolors) / sizeof(indexcolors[0]);
                          int cCol = 0;
                          Painter.begin(&pix);
                        
                          Painter.setPen(QPen(QBrush(Qt::black), 1, Qt::SolidLine));
                          int maxX = mapsize / tilesize;
                          int dark = 0;
                        
                          for (int y = 0; y < maxX; ++y) {
                            for (int x = 0; x < maxX; ++x) {
                              QColor col(indexcolors[cCol]);
                              if (cCol < maxCol) cCol++;
                              else {
                                cCol = 0;
                                dark++;
                              }
                        
                              if(dark == 1)
                                col = col.darker();
                              if(dark == 2)
                                col = col.lighter();
                        
                              Painter.setBrush(QBrush(col) );
                              Painter.drawRect((x * tilesize), (y * tilesize), tilesize, tilesize);
                            }
                          }   
                          Painter.end();
                         ui->labPic->setPixmap(pix);
                        }
                        
                        
                        1 Reply Last reply
                        2
                        • Q Offline
                          Q Offline
                          Qt Enthusiast
                          wrote on last edited by
                          #15

                          Can we generate the table with algorithm ?

                          mrjjM 1 Reply Last reply
                          0
                          • Q Qt Enthusiast

                            Can we generate the table with algorithm ?

                            mrjjM Offline
                            mrjjM Offline
                            mrjj
                            Lifetime Qt Champion
                            wrote on last edited by mrjj
                            #16

                            @Qt-Enthusiast

                            Hi.
                            I thinks it s made using color distance algorithm already.
                            If you mean algorithm to generate all the colors out of nothing, then no.

                            1 Reply Last reply
                            0
                            • Q Offline
                              Q Offline
                              Qt Enthusiast
                              wrote on last edited by
                              #17

                              Algorithm means code

                              mrjjM 1 Reply Last reply
                              0
                              • Q Qt Enthusiast

                                Algorithm means code

                                mrjjM Offline
                                mrjjM Offline
                                mrjj
                                Lifetime Qt Champion
                                wrote on last edited by
                                #18

                                @Qt-Enthusiast

                                the colors are already code. ?

                                1 Reply Last reply
                                0
                                • Q Offline
                                  Q Offline
                                  Qt Enthusiast
                                  wrote on last edited by
                                  #19

                                  Means a pseudo code that generates this table

                                  mrjjM 1 Reply Last reply
                                  0
                                  • Q Qt Enthusiast

                                    Means a pseudo code that generates this table

                                    mrjjM Offline
                                    mrjjM Offline
                                    mrjj
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #20

                                    @Qt-Enthusiast
                                    Nope. Not that i have seen.

                                    1 Reply Last reply
                                    0

                                    • Login

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • Users
                                    • Groups
                                    • Search
                                    • Get Qt Extensions
                                    • Unsolved