How to change the flash color? - watir

I want to change the flash color when using element.flash method. By default its yellow.
I was able to increase the number of flash times and delay time in elements.rb file. But i dont know how to change the highlight color.
Any idea on this?
Using different colors to highlight will be helpful if browser elements have yellow background.

Solution
The flashing is based on the element's container's activeObjectHighLightColor. This is set by doing:
element.container.activeObjectHighLightColor = "colour"
Where colour is a valid web-friendly color (as per the container.rb file).
Example - Flash For Individual Element
As an example, here is changing the flash colour for the text field on the Google search:
#Use google search text field as a test page
ie = Watir::Browser.new
ie.goto 'www.google.ca'
e = ie.text_field(:name => 'q')
#Set the flash colour
e.container.activeObjectHighLightColor = "green"
#Flash the object, which should now be green
e.flash
Note:
This will only work with Watir-classic. Watir-webdriver does the flashing differently.
I only tested this in the latest version of watir-classic, but the code for 2.0.4 appears to be the same.
Example - Default Flash Colour
To change the default flash colour for everything, you need to set the activeObjectHighLightColor for the browser.
If you want to change it for the current browser, do:
ie = Watir::Browser.new
ie.activeObjectHighLightColor = "green"
ie.goto 'www.google.ca'
e = ie.text_field(:name => 'q')
e.flash
#=> Will flash green
If you want to change it permanently (ie so you do not have to set it each time), you can change the colour in the ie-class.rb file:
HIGHLIGHT_COLOR = 'yellow'

Related

Openpyxl: Decode 'auto' color to rgb value

I am trying to determine the color of borders set in an Excel document. I use the 'openpyxl' library (latest Version 3.0.9) and encountered a problem to extract the rgb color code when the user sets the border via the default 'auto' color.
When I extract the cell color property, I see this (in my debugger, see screenshot). None of the cell fields are set with an RGB code, the fields indicate some problem with extracting the color information. I assume this is due to the 'auto' color.
The index color probably refers to this in documentation:
Default Color Index as per 18.8.27 of ECMA Part 4
COLOR_INDEX = (
'00000000', '00FFFFFF', '00FF0000', '0000FF00', '000000FF', #0-4
'00FFFF00', '00FF00FF', '0000FFFF', '00000000', '00FFFFFF', #5-9
'00FF0000', '0000FF00', '000000FF', '00FFFF00', '00FF00FF', #10-14
'0000FFFF', '00800000', '00008000', '00000080', '00808000', #15-19
'00800080', '00008080', '00C0C0C0', '00808080', '009999FF', #20-24
'00993366', '00FFFFCC', '00CCFFFF', '00660066', '00FF8080', #25-29
'000066CC', '00CCCCFF', '00000080', '00FF00FF', '00FFFF00', #30-34
'0000FFFF', '00800080', '00800000', '00008080', '000000FF', #35-39
'0000CCFF', '00CCFFFF', '00CCFFCC', '00FFFF99', '0099CCFF', #40-44
'00FF99CC', '00CC99FF', '00FFCC99', '003366FF', '0033CCCC', #45-49
'0099CC00', '00FFCC00', '00FF9900', '00FF6600', '00666699', #50-54
'00969696', '00003366', '00339966', '00003300', '00333300', #55-59
'00993300', '00993366', '00333399', '00333333', #60-63
)
# indices 64 and 65 are reserved for the system foreground and background colours respectively
The documentation says that Index 64 is reserved so there is no point in trying to access the color array (max index is 63).
Source: https://openpyxl.readthedocs.io/en/stable/_modules/openpyxl/styles/colors.html
I can be brave and deal with index 64 as black, which seems to be the eternal auto-color anyway but I am wondering if there is a proper way to decode the 'auto' color from Excel?
System colours are set by the application. Windows defaults will be white background and black foreground. You can check the colors part of the styles.xml to see if these have been overriden, but really the client application gets to decide.

How to set UIDatePicker background color to white in xamarin.ios for ios 14?

I am hiding a label by a UIDatePicker in a xamarin.ios app. I changed the style of the datepicker label but can't change the background to white. Here is my code:
datePickerDateFrom.Frame = lblFromDate.Frame;
datePickerDateFrom.Subviews[0].Subviews[0].SetValueForKey(UIColor.White, new NSString("backgroundColor"));
datePickerDateFrom.Subviews[0].Subviews[0].TintColor = UIColor.Black;
datePickerDateFrom.Subviews[0].Subviews[0].Layer.BorderWidth = 1;
datePickerDateFrom.Subviews[0].Subviews[0].Layer.CornerRadius = 6;
datePickerDateFrom.Subviews[0].Subviews[0].Layer.BorderColor = UIColor.FromRGB(0, 184, 212).CGColor;
datePickerDateFrom.SizeToFit();
Add(datePickerDateFrom);
And the result is:
Any other color works but if I set the color to white it remains this ash color that's why sometimes there is a color difference inside the blue border when the short date format is selected. I don't know is it possible to align the value inside the frame and specify any fixed date format(as sometimes it displays 3 letter of month name when gets larger space). For now changing the background color to white would be a great help. Thanks in advance.

Marlett font missing from VBA object properties

I want to place a green tick mark on a userform and thought that creating a label with the caption "a" in Marlett font would do the trick. However, Marlett isn't showing up in the object properties despite definitely being installed. I can easily place the tick mark in a cell, but not in a label. Is there a way to enable it for userforms?
There is an answer to the same problem in the c# section - How do I set button font to Marlett, but I'm not sure if it can be applied to VBA as well.
It's as simple as putting:
Label1.Font.Name = "Marlett"
Label1.Caption = "a"
(important: this code only seems to work if you set the font before setting the caption; setting the caption first seems to prevent setting the font from having an effect - thanks to #N.N.Thoughts for the info)
in the Userform_Initialize event of your userform. Replace Label1 with the name of the actual control
edit: with the addition of code to set the font size and colour:
Label1.Font.Size = "32"
Label1.ForeColor = RGB(0, 255, 0)

CKEditor: Different color palettes for Text Color and Background Color possible?

I am using CKEditor (v3.6.4) and try to find out how to change the palettes for Text Color and Background Color separately.
I found config.colorButton_colors in the docs which allows me to define the color palette. However, this palette is assigned to both, text and background.
How can I have two different palettes?
The best and easy way is, Include required plugin at the download time or link below
Ckeditor Builder
Yes its actually possible. Just dont pick colors from the config but rather do the following in colorbutton/plugin.js:
var textColors = '1ABC9C,2ECC71,3498DB,9B59B6,4E5F70,F1C40F,' +
'16A085,27AE60,2980B9,8E44AD,2C3E50,F39C12,' +
'E67E22,E74C3C,ECF0F1,95A5A6,DDD,FFF,' +
'D35400,C0392B,BDC3C7,7F8C8D,999,000';
var backgroundColors = 'cee8fe,b1d7ff,c7d3f3,dfd6eb,e4cafe,ffbbff,ffbfd2,ff9999,ffdeb3,ffefb0,f4f98a,ffffbb,d3f1a1,bbffbb,bbffff,a6e3dc,c1ebc7,eddec9,f2ebd3,d3eaf2,e1eff3,ffbe61,ffdc61,e1f29d';
var colors = (type == 'back') ? backgroundColors.split(',') : textColors.split(',');
You can't do that because the color palette is defined for the text color and background.
CKEDITOR.config.colorButton_colors =
'000,800000,8B4513,2F4F4F,008080,000080,4B0082,696969,' +
'B22222,A52A2A,DAA520,006400,40E0D0,0000CD,800080,808080,' +
'F00,FF8C00,FFD700,008000,0FF,00F,EE82EE,A9A9A9,' +
'FFA07A,FFA500,FFFF00,00FF00,AFEEEE,ADD8E6,DDA0DD,D3D3D3,' +
'FFF0F5,FAEBD7,FFFFE0,F0FFF0,F0FFFF,F0F8FF,E6E6FA,FFF';
Or you can change the Text Color plugin :)

HighCharts: Color of label according to the color of pie slice

Title of this questions says everything. I only found out how to change the color of connectors. If I delete the color: option, they´re all grey. I tried to put in the field with stored colors in hex, with no result, stayed black.
In dataLabels.formatter you have access to this.point.color. So simple set useHTML: true for dataLabels, and create spans with specified colors.
the formatter function gives you a callback object, which has a color property that can be set with the color of your choice
formatter: (format) ->
format.color = #point.color

Resources