I'd like to know how to customize colors for captcha image with zend_captcha_image.
The one I could make it work is like this
$this->captcha = new Zend_Captcha_Image();
$this->captcha->setWordLen('4')
->setHeight('60')
->setFont("font.ttf");
it comes with black text and white background, what if I want to use different colors for font in captcha image.
The colours appear to be hard-coded into the _generateImage() method of the Zend_Captcha_Image class, so can't easily be changed. You would need to extend this class and override that method to use your own colours. Specifically these two lines:
$text_color = imagecolorallocate($img, 0, 0, 0);
$bg_color = imagecolorallocate($img, 255, 255, 255);
Related
I am exploring Mudblazor. I created a doughnut chart and it works fine. But I need to define the colors of the slices of the pie/doughnut. I see you can have a class for the entire chart, but how do set custom colors for each slice of the pie?
The default for a 3 slice pie is like blue, teal and gold. I need to change those colors and will need to be changed in code also.
The theming palette options don't seem to have options for this.
Thanks,
Michael
Edit: I figured it out. In case anyone else needs to do this. Example:
ChartOptions options = new ChartOptions();
protected override void OnInitialized()
{
string[] colors = { "#ff0000", "#00FF00","#0000ff" };
options.ChartPalette = colors;
}
Chart-add ChartOptions="#options":
I'm trying to add a shadow to my product boxes in Shopify, but the class name has a space in it. It looks like this:
article class="item collection-product"
I'm not familiar with Shopify but to me, it looks like there are two classes. You would target them like this:
.item.collection-product {
// CSS here
}
For classes you can use ., for IDs #.
You can apply multiple classes to anything, and all the CSS will apply in ascending order. So say class 1 has color blue, and class 2 comes after this in your CSS and has color green, color green would overwrite color blue unless you do something like !important for example:
.1class2{
color: blue !important;
}
.class2{
color: green;
}
Check this out for more info: https://stackoverflow.com/a/7270033/142410
I am working on a codename one application. I need to remove the border for Accordion component. (or) Is there anyway to change the Accordion's border color..
Can someone guide me...
The black border shown in the image
In your theme.res, just add a UIID with no border and set this UIID for accordeon.Otherwise , you can override accordeon UIID and set empty border like this :
And then uncheck derive and select border "empty"
To remove(hide) the border of an accordion from the code you can define it's border colour to be the same as the background colour and to be as narrow as possible.
Border border = Border.createCompoundBorder(Border.createLineBorder(1, 0xffffff), Border.createLineBorder(1, 0xffffff), Border.createLineBorder(1, 0xffffff), Border.createLineBorder(1, 0xffffff));
my_accordion = new Accordion(ifont_keyboard_right, ifont_keyboard_down);
my_accordion.getAllStyles().setBgColor(0xffffff);
my_accordion.getAllStyles().setBgTransparency(255);
my_accordion.getAllStyles().setPadding(0, 0, 0, 0);
my_accordion.getAllStyles().setMargin(0, 0, 0, 0);
my_accordion.getAllStyles().setBorder(border);
I want to select two or more markers in a chart and perform an action using their coordinates.
Selecting the points is the main problem since I didn't find anything on this topic and I'm not sure if it can be done.
I did something like this in a Pie Chart.
What I did was use "connectToPlot" to change the series color when the user click on it.
This is a resume of the work that I did: change series color when user click on it
See that when you click on the serie, the color changes to gray and if you click again the series returns to it original color (saved it in the attribute "originalColor").
pieChart.connectToPlot("default", function(evt) {
var shape = evt.shape;
var type = evt.type;
if (type == "onclick") {
var fillColor = "rgb("+shape.fillStyle.r+", "+shape.fillStyle.g+", "+shape.fillStyle.b+")"; console.log(shape.fillStyle);
if(shape.rawNode.getAttribute("originalColor")==null)
shape.rawNode.setAttribute("originalColor",fillColor);
var strokeColor = "rgb("+shape.strokeStyle.color.r+", "+shape.strokeStyle.color.g+", "+shape.strokeStyle.color.b+")";
if(fillColor=='rgb(238, 238, 238)'){
shape.setFill(shape.rawNode.getAttribute("originalColor"));
shape.setStroke(shape.rawNode.getAttribute("originalColor"));
}else{
shape.setFill('rgb(238, 238, 238)');
shape.setStroke(shape.rawNode.getAttribute("originalColor"));
}
}
I have a div
<div class="blue>;
The class blue is:
.blue {
background-color: blue;
}
Now I know I can set the background color of the div in the console using:
$0.style.backgroundColor = "#ffcc00"
But what if I want to get the value of the background color for that element using the console?
It's possible you may want computed style:
var style = getComputedStyle(document.body, null); // Gets the style for a passed element and optional pseudo selecter (eg. :hover)
console.log(style.backgroundColor);
It's important to note that computed style is the rendered result. If you have multiple rules for the same element, this will only display the ones that have been applied.
You can do :
var blue = document.getElementsByClassName('blue')[0];
blue.style.getPropertyCSSValue('background-color');
or you do:
blue.style.getPropertyValue('background-color');