Available Colors for SetConsoleTextAttribute - api

im working with SetConsoleTextAttribute API (Delphi to be specific), well anyway i cannot find a list of available colors anywhere?? can anyone help me out

There a 4 Bits used for the foreground color
FOREGROUND_BLUE; //1
FOREGROUND_GREEN; //2
FOREGROUND_RED; //4
FOREGROUND_INTENSITY; //8
which will give 16 possible colors. (0-15)
The next 4 bits are used for background color with the same scheme

See this. Colors are formed by ORing different constants. For instance:
An application can combine the foreground and background constants to
achieve different colors. For example, the following combination
results in bright cyan text on a blue background.
FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY |
BACKGROUND_BLUE
For more Turbo/Borland Pascal CRTish implementations of such, see this. The colors available in the Windows console via SetConsoleTextAttribute work out roughly to be the same ones as the CRT unit, so any more relevant details can be found there.

Related

Change support and resistance line color in mplfinance

Currently, I'm using this code. How can I change the hlines to red if it's a resistance and blue if it's a support?
mplfinance.plot(df,
type = 'candlestick',
style = 'binance',
hlines=dict(hlines= support_resistance,linestyle='-', linewidths = (1,1)),
volume = True)
I'm getting results like this:
hlines=dict(hlines= support_resistance,linestyle='-',linewidths = (1,1),colors=('b','r')
See for example cell "In [6]" in this tutorial: https://github.com/matplotlib/mplfinance/blob/master/examples/using_lines.ipynb
You may need to include as many colors as you have support_resistance lines. So for example, maybe something like: colors=['b','r','b','r','r','r']
Regarding handling support resistance colors dynamically (per your comment) it is not appropriate for mplfinance to provide algorithms for determining support or resistance, only to provide tools to make it easier for you to visualize them.
Also, each user may have their own specific way of determining support or resistance.
Presumably as you are building the support_resistance list, at the point in your code where you are adding a specific price to that list, you probably know whether that price represents support or resistance. At the same point in your code you should add a color ('b' or 'r') to the colors list. That way you dynamic build two lists: support_resistance, and colors which end up being the same length.
Based on the suggestion from Daniel, I made a list of colors as follows and it worked. support_resistance variable here consists of both support and resistance levels.
colors = []
for lvl in support_resistance:
if lvl > df['Close'][-1]:
colors.append('r')
else:
colors.append('b')

How do I change position offset of wheelnav.js spreader title text

I have failed after several attempts, and massive search attempts (which I may have just failed at), to determine how to move the text in the spreader title to accommodate use of the spreaderStartAngle and spreaderSliceAngle settings, which allow for changing the wheel to smaller sizes (180 or 90 degree versions in my case).
The demo on the site shows the text moving away from the center (starting as a 360 degree circle) down to a quadrant. But in my own use, the re-positioning does not occur automatically, and I see no additional attributes being applied that would cause this.
I have dived into more detail and found that there is apparently something in the Rafael library that may being modified (when looking at the source on the demo page), but it is beyond my understanding on how to approach this via the existing methods.
Anything I have tried makes no change to the text location, which is always centered in what would have been a full circle, regardless of the actual spreader's start and end.
You can position spreader's title via the spreaderPathCustom property.
wheel.spreaderPathCustom = spreaderPath().PieSpreaderCustomization();
wheel.spreaderPathCustom.titleRadiusPercent = 0.58;
wheel.spreaderPathCustom.titleSliceAnglePercent = 0.45;
PieSpreaderCustomization belongs to PieSpreader. The above values of titleRadiusPercent and titleSliceAnglePercent are suitable for 90 degree.

Is there a resolution handling library for love2d on windows

Push.lua is great resolution handling library but some of its functions are limited in windows.
Especially when it comes to changing color.
And that is what I am having the problem with.
Whenever I give a specific color, it shows white.
Could anyone please tell me if there is any other resolution handling library for love2d on windows or if there is anyway I can get push.lua to work with changing some of its code.
RGB values must be a decimal number between 0 and 1 in the current version of love2d. By calling love.graphics.color(127, 45, 22) this will actually default to love.graphics.color(1,1,1) (which is the colour white) because 1 is the maximum value for R, G and B. If you want the RGB values of 127, 45 and 22 you should enter love.graphics.color(127/255, 45/255, 22/255) which is equivalent to love.graphics.color(0.498, 0.176, 0.086)

How to use Inversable features in prestashop

This is a very special problem I met in Prestashop.
I have a product, let's say a two color wooden stick, which is a normal 10" long stick. Half of it (5") can be blue and the other half red for example.
My product is this: Two color wooden stick. I have the following features: color 1 and and color 2 .
In the admin at the product's features I check red for the color 1 and blue for color 2.
Now the problem: when user filters using layered navigation, maybe they select blue for color 1 and red for color 2. This will result displaying 0 products as our wooden stick is inverse, but in the reality it's the same product.
How could I make that possible without duplicating the wooden stick product?
I see there is mismatching, your product 10" is not blue OR red, but blue-red in same time, so set two different colors is bad idea, instead I can propose you to do next, I hope when you said that you use color features it is named in Presta backoffice attributes, there is the difference between two this things in Presta, so:
in Catalog -> Product Attributes create new P.Attribute with name Color and for last option choose Color or textures in dropdown
add new Value for this new Color p.atrribute named e.g. "blue-red" and upload texture (img) that contains both colors. Repeat this procedure as much as needed.
in Layered navigation use this new p.attribute instead old
OR
another idea, create using same way 2 different color attributes Color1 and Color2, no textures, just use real separate colors there like "red", "blue". Then in product create combinations of this two colors and assign it to product.
In this case in layered navigation you will can set 2 filters - Color1, Color2 and customers will can to choose it. But, imho, first solution is better for UX.

The best way to change background color in image in Cocoa

Little description:
I get an image from my scanner using Capture Core Framework and background color is gray. So I want to do white background.
I'm looking for best way to remove this color. I looked at Image Core Filters. And as I understood I should use those ones, but I couldn't find included/ready filterfor this task. So, Do I have to write it myself?
It means to remove color I should write my own filter and apply it to my images? Right? Thank you.
UPD: I develop for Mac os
Why not just simply change the brightness of your image? If this gray background color value is fixed then you can increase the brightness a little bit, as a preprocess step, until you're satisfied.
A filter isn't quite the right tool for the job here. Filters apply a colour-shifting algorithm, pixel by pixel, to all of the pixels in an image.
This would be appropriate in your case if there was something completely unique about the pixels that you want to turn to white. For example, if the background you wish to eliminate was in a very narrow colour range that did not occur in any other part of the image. This is the technique used in greenscreen/bluescreen filming, which only works if that green or blue colour does not occur anywhere in the image regions you want to keep.
But - as you say in one of your comments - you cannot do this as that grey level you want to get rid of will not be unique to the background, so any filter you apply that would pick out those pixes may also affect pixels in the scanned subjectmatter.
What you really need is a way to select a region of interest and apply a filter to that region alone. You could use openCV for this. In fact it has a function that can achieve your result in one go:
http://docs.opencv.org/modules/imgproc/doc/miscellaneous_transformations.html?highlight=floodfill#int
floodFill(InputOutputArray image, //image to process
Point seedPoint, //starting pixel
Scalar newVal, //New value of the repainted domain pixels
Rect* rect, //optional output param (you won't need it)
Scalar loDiff, //max lower brightness/colour diff to select
Scalar upDiff, //max upper brightness/colour diff to select
int flags) //you want FLOODFILL_FIXED_RANGE
This function starts from a seedPoint, which should be any pixel that you can guarantee will be a part of the background grey you want to eliminate. (0,0) might work for you. It then interrogates neighbouring pixels, including them in the ROI array if they are sufficiently similar. The resulting array is a connected region. If your background grey uniformly falls between loDiff and upDiff - and your subject scan has a defined edge which does NOT fall into this range, you will get your result - selection and remapping of all background pixels to newVal (white).