omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    module to generate distinct colors

    Pythonista
    2
    5
    2183
    Loading More Posts
    • 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.
    • upwart
      upwart last edited by

      Here's a module to generate a specified number of distinct colors.
      You can exclude certain colors, most likely black or white by gving a list of color tuples to be excluded.

      So for instance:
      import distinct_colors
      c=distinct_colors.distinct_colors(10,[(0,0,0)])
      generates ten distinct colors without using black.

      https://gist.github.com/7410aaeb951dc659f8f2

      1 Reply Last reply Reply Quote 0
      • filippocld223
        filippocld223 last edited by

        what's the utility? in scene scripts?

        1 Reply Last reply Reply Quote 0
        • upwart
          upwart last edited by

          You can use the colors in a scene or canvas script (the main functions shows an example with canvas).
          I personnaly developed it to be used in a game (with scene) where I needed a number of colors to be easily distinguized.

          1 Reply Last reply Reply Quote 0
          • filippocld223
            filippocld223 last edited by

            Great work :-)

            1 Reply Last reply Reply Quote 0
            • upwart
              upwart last edited by

              Here is an update, with improved quality an stability.

              https://gist.github.com/ede14e200fbeeb331786

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Powered by NodeBB Forums | Contributors