cmd how do i use 24 colors? - c++

When i select the dark colors they get inverted to a color that don't applies to the console. If i select dark yellow "rgb 0 128 128" it inverts to a light blue "rgb 127 127 255" color, that color is not a standard color and can't be used by ordinary methods like,
SetConsoleTextAttribute, ANSI.SYS \033[1;34m
It would help me so much if i could get the answer.
Thanks! :)
Picture Of The Colors

The question is: how to make colors of selected-cells on a console window look like some reversed version (e.g., foreground and background switching) of the unselected colors.
This behavior is built into the console window (or more generally, a terminal). There is no escape sequence or other documented feature of console windows which can do this.
In the more general sense, this aspect is different on various terminals. xterm for example can:
exchange foreground and background colors, or
use specific colors for the selected text.
xterm does this by mapping between different items in its color table.
Some other terminal may implement the color change by XOR'ing the color value, mapping 0 to 255 and 255 to 0 (white/black). This is very simple to implement. However, for colors other than white and black, it produces an effect like that shown in your picture.

Related

How Do I Change NavigationBar Color For WatchOS?

I am building watchOS app and I am trying to change navigationBar background color from black to transparent, but I am not able to find anything. I saw this question which was asked in 2015, according to which it is impossible to change navigationBar color in watchOS. I was wondering if now there is any API for that.
Thanks for any help.
This is about Color in the human-interface-guidelines from apple:
Make sure your app’s colors work well in both light and dark
appearance modes. With the exception of watchOS, which always uses a
pure black background, the platforms offer a dark alternative to the
default light appearance. Dark Mode uses a darker color palette for
all screens, views, menus, and controls, and can increase vibrancy — a
subtle effect that dynamically blends foreground and background colors
— to make foreground content stand out against darker backgrounds.
System colors automatically support both appearances; if you use a
custom color, you need to supply both light and dark variants. For
guidance, see Dark Mode.

Visual Studio VSPackage icon displays different colors

I am trying to provide an icon for the button that activates my custom VSPackage extension.
When designing the icon, the following colors are used:
Foreground: #fff (white)
Background: #a375e7 (light purple)
When displaying the icon in the button within Visual Studio (Solution Explorer, top), the following colors are seen:
Foreground: #000 (black)
Background: #5c1fb7 (dark purple)
The icon is not disabled.
The icon comes from a PNG file with multiple icons in it. Each icon is 16 x 16 pixels.
Admittedly, I am not an expert on image manipulation so my educated guess is it's something simple concerning image settings at design time, prior to export.
Any ideas?
In order to make icons appear with the correct contrast ratio in the Visual Studio dark theme, an inversion is applied programmatically.
See Color inversion for dark themes in Images and Icons for Visual Studio documentation.
To opt-out from the inversion, you can try to set top-right pixel to cyan (#00FFFF). From IVsImageService2.ThemeDIBits documentation:
Applies theming to BGRA32 device-independent bitmap bits. The luminosity of the image is transformed so that the constant "halo" luminosity blends in with the background. This has the effect of eliminating the halo visually. The "halo" luminosity is an immutable constant, and is not calculated from the input image. Images which contain cyan (#00FFFF) in their top-right pixel are not inverted. Instead, the top-right pixel is cleared (RGBA are all set to 0) and S_OK is returned without otherwise modifying the image.

White color in LS_COLORS with MSYS

I'm using MSYS in a Windows machine. I've configured my LS_COLORS in .profile to color the files in white and folders in green:
LS_COLORS='fi=01;37:no=00:di=01;32'
I've set the text color of the window where msys.bat will be run as green, so whatever I write in the console appears in green. This, however, makes the white color I set for the files be green instead. This means the 37 won't set a white color, but the default text color of the window instead.
Is there a way to make the input appear in green and the files listed with ls appear in white?
You'll need to set one of the colors for the window to be white, and then set LS_COLORS to use that color instead of color 7. Using 3f instead of 37 should give you color 15.
A window has 16 colors set for it, that you can see by selecting properties -> colors by right-clicking on the border. Generally color 0 is the background and color 7 is the foreground (and many programs may assume that) though that can be changed as can the actual colors of any the 16 color codes.

ClearType ruins transparency

I have a bitmap which background needs to be replaced with part of another bitmap. Everything works fine until I enable ClearFont on my WindowsXP.
In order to explain my problem better, let us label first bitmap as bmpDestination and second as bmpSource.
Here is how the bmpSource looks like :
Here is how bmpDestination looks like :
When ClearType is off, here is how the correct result looks like :
And here is the incorrect result of their combining when ClearType is on:
ClearType alters some parts of the text background color, so they aren't white anymore ( RGB( 255, 255, 255 ) ) but a combination of white and text color.
I am using BitBlt() and monochrome bitmap to create a mask, and to simulate transparency. I have tried using TransparentBlt() too, but got the same result.
How can I combine bmpSource and bmpDestination, when ClearType is enabled, so I can create correct result like above ?
Thank you for your help.
Best regards.
Render the treeview with black text on a white background. Use a font with grey-scale anti-aliasing. Don't use ClearType anti-aliasing. I'm moderately sure you can achieve this with one of the fdwQuality parameters to CreateFont, but I wouldn't swear to it.
Each pixel will have a shade of grey between white and black. You can interpret this as transparency. White is fully transparent; black is fully opaque. Use this information to create a bitmap with transparency. Render this transparent bitmap over your multi-coloured background.

C++ Windows Console Color Palette

I am making a console application similar to a rudimentary AAlib for a class. I am working with the win32 console. I wish to have more colors to work with. In the properties menu for the console there is a palette, giving 24 bit colors to foreground and background. Is there any way to access this palette in code?
The only thing I can think of is redefining the color palette[n] in HKEY_CURRENT_USER\Console for each call to color a character.
Alternatively if anyone knows a method for printing to window class like a terminal(where each character could have background color, not a fill) that could also work.