module std/graphics/color.monkey2 additions

About Monkey 2 Forums Monkey 2 Development module std/graphics/color.monkey2 additions

This topic contains 16 replies, has 6 voices, and was last updated by  AdamStrange 2 years, 9 months ago.

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #2259

    AdamStrange
    Participant

    Here are some more pre-defined colors:

    #rem monkeydoc Brown.
    #end
    Const Brown := New Color( .62,.31,0 )

    #rem monkeydoc Lime.
    #end
    Const Lime := New Color( .54,.74,.14 )

    #rem monkeydoc Mango.
    #end
    Const Mango := New Color( .94,.58,.03 )

    #rem monkeydoc Orange.
    #end
    Const Orange := New Color( .79,.32,0 )

    #rem monkeydoc Pink.
    #end
    Const Pink := New Color( .79,.44,.72 )

    #rem monkeydoc Purple.
    #end
    Const Purple := New Color( .41,.13,.48 )

    #rem monkeydoc LeafGreen.
    #end
    Const LeafGreen := New Color( .2,.6,.2 )

    #rem monkeydoc Yolk.
    #end
    Const Yolk := New Color( 1,.65,0 )

    #rem monkeydoc Peach.
    #end
    Const Peach := New Color( 1,.8,01 )

    #rem monkeydoc Sand.
    #end
    Const Sand := New Color( .94,.87,.7 )

    #rem monkeydoc WetSand.
    #end
    Const WetSand := New Color( .83,.76,.58 )

    #rem monkeydoc NavyBlue.
    #end
    Const NavyBlue := New Color( .09,.15,.44 )

    #rem monkeydoc Morello.
    #end
    Const Morello := New Color( .6,.34,.71 )

    #rem monkeydoc Teal.
    #end
    Const Teal := New Color( .22,.43,.5 )

    #rem monkeydoc SkyBlue.
    #end
    Const SkyBlue := New Color( .2,.59,.85 )

    #rem monkeydoc LightGreen.
    #end
    Const LightGreen := New Color( .18,.8,.44 )

    #rem monkeydoc Mint.
    #end
    Const Mint := New Color( .08,.62,.52 )

    #rem monkeydoc Silver.
    #end
    Const Silver := New Color( .74,.76,.76 )

    #rem monkeydoc Gold.
    #end
    Const Gold := New Color( .83,.66,.29 )

    #rem monkeydoc Forest.
    #end
    Const Forest := New Color( .17,.31,.21 )

    #rem monkeydoc TreeTrunk.
    #end
    Const TreeTrunk := New Color( .31,.23,.17 )

    #rem monkeydoc Plum.
    #end
    Const Plum := New Color( .36,.2,.36 )

    #rem monkeydoc Watermelon.
    #end
    Const Watermelon := New Color( .85,.32,.32 )

    #rem monkeydoc Avocado.
    #end
    Const Avocado := New Color( .55,.69,.12 )

    #rem monkeydoc BubbleGum.
    #end
    Const BubbleGum := New Color( .83,.36,.61 )

    #rem monkeydoc Maroon.
    #end
    Const Maroon := New Color( .47,.18,.16 )

    #rem monkeydoc Coffee.
    #end
    Const Coffee := New Color( .55,.44,.36 )

    #rem monkeydoc Lavender.
    #end
    Const Lavender := New Color( .6,.67,.83 )

    #rem monkeydoc PowderBlue.
    #end
    Const PowderBlue := New Color( .72,.78,.94 )

    #rem monkeydoc GreyBlue.
    #end
    Const GreyBlue := New Color( .22,.29,.5 )

    #rem monkeydoc Umber.
    #end
    Const Umber := New Color( .7,.53,.0 )

    #rem monkeydoc Buff.
    #end
    Const Buff := New Color( .84,.77,.64 )

    #rem monkeydoc Cobble.
    #end
    Const Cobble := New Color( .47,.38,.33 )

    #rem monkeydoc Aqua.
    #end
    Const Aqua := New Color( .59,.67,.68 )

    #rem monkeydoc LightKhaki.
    #end
    Const LightKhaki := New Color( .78,.78,.59 )

    #rem monkeydoc DragonFruit.
    #end
    Const DragonFruit := New Color( .80,.38,0.5 )

    #rem monkeydoc Ember.
    #end
    Const Ember := New Color( .74,.47,.34 )

    #rem monkeydoc Olive.
    #end
    Const Olive := New Color( .52,.6,.1 )

    #rem monkeydoc Corn.
    #end
    Const Corn := New Color( .91,.8,.32 )

    #rem monkeydoc Honeysuckle.
    #end
    Const Honeysuckle := New Color( .95,.48,.59 )

    #rem monkeydoc Phlox.
    #end
    Const Phlox := New Color( .52,.25,.51 )

    #rem monkeydoc Khaki.
    #end
    Const Khaki := New Color( .56,.56,.39 )

    #rem monkeydoc Nougat.
    #end
    Const Nougat := New Color( .83,.73,.62 )

    #2260

    wiebow
    Participant

    Nice man!

    #2264

    cocon
    Participant

    Here are some colors from MonoGame

    To autogenerate the colors I used this snippet in the browser:

    #2272

    AdamStrange
    Participant

    Great addition, but you will have to merge the two together as there are duplicates which will not compile

    #2282

    cocon
    Participant

    I merged the list with yours, however there were some differences with the color values, I don’t know exactly about which is better, but I kept those of MonoGame.

    Perhaps there might be various classes and each one might have its own palette.

    #2283

    sicilica
    Participant

    You wrote a script to write the monkey code? I mean, clever solution, and not to be condescending, but… why not sublime text?

    In any case, I might yank this just so I never feel like I have to new up a Color object, since any time I construct a throwaway just for data transfer my pre-optimization nerves tingle. Thanks.

    #2285

    jondecker76
    Participant

    I would like to see the New method overloaded for a more common convention of using 0-255 Ints while creating colors.  Of course, floats would still be used internally, but for convenience I think this would be nice

    #2286

    sicilica
    Participant

    I disagree. Even though you could argue that you can tell which version it is by looking at Ints and Floats – having two constructors with very different functionality that both use numeric types is confusing. IIRC it was inconsistent before, like mojo1 used 0-255 and mojo2 used 0-1 or something, and anytime I needed to set a color I never knew what format I was supposed to be using. The most important thing is consistency, and if you only have one, 0-1 is more useful for most applications.

    Couldn’t you use Color.FromARGB? Or else just multiply by something. I will say, it would make sense to me for FromARGB to have an overload that takes four Bytes instead of one Int.

    Const BYTE_TO_FLOAT:= 1.0/255.0

    #2287

    jondecker76
    Participant

    As long as documentation is good. I don’t see where the confusion would be.  I know of no other paint or color program that deals with rgb data as floats, so to me this is a different kind of inconsistency. Quite actually I’d also like an overload for htmlcolor strings as well

    Nevertheless. For my own needs I’ll just extend Color and add my own overloads- was just adding my opinion

    #2290

    AdamStrange
    Participant

    @cocoon What did you use to embed the text as code?

    OK, I see the changes and how you’ve merged them. There are a number of missing entries. I’ll take the new list and generate a newer version with these additions 😉

    @sicilia Ignoring that 0..255 is easier than 0..1. Internally The colors are always converted down to 0..1 especially when dealing with opengl and shaders. So I suppose it make a bit more sense getting Your head into this way of doing things. But I agree in that a simple additions to use 0..255 for setting colors could be added.

    #2291

    wiebow
    Participant

    It would be nice if it could be merged into the monkey2 source. BUT, there are a lot of color definitions now, is there an online reference on these, so one can look up the table with example colours online?

    #2292

    AdamStrange
    Participant

    Yep you’re quite right about the definitions multiplying and getting out of hand.

    There is method in my madness though with a brand new color picker built directly into Ted21 which will include all these additions and make it simple.

    This is not a concept, It is a real working thing now. I am just about to add the color definitions to it. You can see I am already working with color families

    #2296

    wiebow
    Participant

    That is really nice 🙂

    #2302

    Danilo
    Participant

    +1, ($FF,$FF,$00) and ($FFFF00) should both be supported
    for creating/constructing a color type using ‘New’.

    Also, i’m wondering why it’s all constants of ‘New Color’.
    Hope it’s not instances of type Color to bloat the resulting executable.

    With support for $FFFF00 it could be just Enum type.

    Many programmers think in RGB(A) Colors of $40, $80, $FF, …

    #2305

    cocon
    Participant

    You wrote a script to write the monkey code? I mean, clever solution, and not to be condescending, but… why not sublime text?

    At this time I wanted to convert the values from integer 255 to float 1.0 and as an additional bonus I did some string concat to hit two birds with a stone.

     

    What did you use to embed the text as code?

    There is this [<>] icon at the top right of the editor.

     

    There are a number of missing entries.

    I did sort the lines with Sublime and removed the doubles with the eye, perhaps the best way is to use the Javascript generator again. 🙂

    Attachments:
Viewing 15 posts - 1 through 15 (of 17 total)

You must be logged in to reply to this topic.