Spectrum color picker HSV to RGB - colors

Hi i'm trying to use this:https://bgrins.github.io/spectrum/ colorpicker on my web and it works well but it has one issue - output is hsv that can't be used in css.
Is here any way to change the output to rgb or hsl?

Initialise your spectrum call with preferredFormat set to rgb, hsl or hex.
https://bgrins.github.io/spectrum/#options-preferredFormat

Related

Convert RGB Color in SVG to Spot Color in PDF

we are building an web application to design print products online. There are also some special finishes available for print. For example gold foil. There for we have to define the color in the final PDF in a specific way. It has to be a spot color with 100% magenta (c0 m100 y0 k0) and th color name "goldfoil".
In the design tool we are using a color with a hex code that is looking similar to gold in the browser (#9C9475). Our application is creating SVG that is converted via ghostscript to the PDF.
What I now want to achieve is to define a fallback or exchange color for specific hex colors like in this example #9C9475 that will convert this color in the PDF to the above described spot color.
Will this be possible? I found an article that svg 1.1 and above is supporting ICC Profiles and can produce CMYK and ICC named colors. In the documentation it says that I can define spot color in this way:
<color-profile name=„ISOcoated_v2_eci" xlink:href="http://swatches.example.com/ISOcoated_v2_eci.icc"/>
<circle fill=„#9C9475 icc-color(ISOcoated_v2_eci, Goldfolie"/>
But then I am missing the CMYK values.
Can somebody help me in this case?

LibGDX - change the inside color, not border

I have a rounded square texture, drawn in paint, with black border. How can I change only the inner color without changing the border color?
EDIT: I did it, but I want to ask if it can be done without using another texture? I also wonder if there is a connection between this and 9patch as in scaling. Can we use that or is there something like that?
You can tint whatever it is what you are drawing, using SpriteBatch. This means that color you specify is multiplied with the color of the image. For example if your image is a white rounded rectangle with a black border and you tint it using the color purple then the inside will be purple and the border will remain black. You didn't provide enough information to be more specific. But if you are for example using the Sprite class then you can use the setColor method to tint it. Likewise if you are using the Image class. If you are drawing the "texture" directly using SpriteBatch then you can use the setColor method of the SpriteBatch.

GIMP - Alpha to Color

I have created a simple square using GIMP which color is a shade of blue (#07192c). I lowered the opacity on this square a bit, and realized I like the shade of blue which was now created from lowering the opacity.
My question is, does GIMP have a function which allows you to select (like the eyedropper) the color of a transparent layer? I've searched but can only find 'color to alpha' which is not what I'm looking for.
You can activate the Sample merged option of the Color Picker tool. This will pick the color as it is shown in the image composition.
This setting is available in the tool options for the color picker:
Layer -> Transparency -> Remove Alpha Channel
Colours -> Map -> Colour Exchange...

convert basic RGB to alpha in pygame

light_green = (0,200,0,100)
pygame.draw.rect(game_display,light_green,(50,200,60,110))
I know that this has the alpha property in the 4th section(100). But it is not transparent when applied on top of a background. It is simply just a solid square block. I want to be able to see the background through the square. Any help always appreciated. Thanks :)
The draw module's functions do not draw transparent. See the documentation for draw
Most of the arguments accept a color argument that is an RGB triplet.
These can also accept an RGBA quadruplet. The alpha value will be
written directly into the Surface if it contains pixel alphas, but the
draw function will not draw transparently.
A workaround is to use the respective functions from the pygame.gfxdraw module instead, they add transparency, for your case the box function.
import pygame.gfxdraw
light_green = (0,200,0,100)
pygame.gfxdraw.box(game_display, pygame.Rect(50,200,60,110), light_green)
If you only want to draw rectangles you can as an alternate way directly fill a Surface and blit it to the screen.
light_green = (0,200,0,100)
s = pygame.Surface((60, 110), pygame.SRCALPHA)
s.fill(light_green)
game_display.blit(s, (50, 200))

color blending with GDI+

I am refering to a older question saying color blending with GDI+
Using GDI+ with Windows Forms, I want to be able to draw with a pen and blend color based on the destination pixel color.
For example, if I draw a line and it passes over black pixels, I want it to be a lighter color (like white for example) so that it's visible. When that same line passes over white pixels, it should be a darker color (black for example) so that it's still clearly visible.
the answers says to use a color matrix for transformation
so i started implementing it..
My image is present in raw data format in rgb48
Gdiplus::Bitmap image(input.width,input.height,input.width*6,PixelFormat48bppRGB,(unsigned char*)rgb48);
Gdiplus::Image *images= image.GetThumbnailImage(input.width,input.height);
Gdiplus::TextureBrush brush(images);
Gdiplus::Pen pen(&brush);
Gdiplus::ColorMatrix matrix={
-1.0f,0.0f,0.0f,0.0f,0.0f,
0.0f,-1.0f,0.0f,0.0f,0.0f,
0.0f,0.0f,-1.0f,0.0f,0.0f,
0.0f,0.0f,0.0f,1.0f,0.0f,
1.0f,1.0f,1.0f,0.0f,1.0f,
};
Gdiplus::Graphics gfx(&image1);
Gdiplus::ImageAttributes imageAttr;
imageAttr.SetColorMatrix(&matrix);
gfx.DrawImage(images,Gdiplus::Rect(0,0,input.width,input.height),0,0,1024,1024,Gdiplus::UnitPixel,&imageAttr);
I am not getting what i expect..Can some one help me in finding the mistake i m doing.
You can use the alpha component of a color to specify transparency, so that colors can be combined. However, if you want the combination to be something other than the alpha blend, you must draw the pixels yourself. You could first draw into a transparent bitmap, then render that onto the destination pixel by pixel.

Resources