How to change the color of the placeholder text using react-bootstrap-typeahead? - react-bootstrap-typeahead

Using react-bootstrap-typeahead there is an option to provide placeholder text.
How can I change the color of this text? I can't find the relevant selector to target the placeholder text element on the demo page:

I found the answer at https://stackoverflow.com/a/31045763/906814 - it's completely unrelated to react-bootstrap-typeahead, which after all just creates a standard input with a placeholder:
input[type="text"]::-webkit-input-placeholder {
color: red;
}

Related

How to change the color of rows and text in aggrid on selection

I have a Aggrid and have to change the color of row and text from default blue and black to green and white when we select a row in Aggrid.
I tried making use of this, but the color of links in text does not change to white
It is not related to ag-grid. All you need is to add different CSS rule for links inside a selected row, to override link color (and also, probably, :hover, :active, :focus states).
.ag-row-selected A {
color: while;
}

How to replace specific range of text with other text or label in VSCode API

Some kinds of text are in an encoded form, I want to convert them all to UTF8 form.
Such as convert "%E6%B5%8B%E8%AF%95" to "测试" but also do not change the file, meaning "%E6%B5%8B%E8%AF%95" is displayed as "测试" until I edit it.
Is there a way to do that?
I tried activeEditor.setDecorations(), but it can only change the style and also cannot hide the original text. I also tried HoverProvider - it helps, but it's not exactly what I want.
This is indeed possible by using decorations (at least now in 1.52.1).
We can add text with the before or after properties.
And we can hide the original text by setting its opacity to 0 and by abusing letterSpacing with a negative value to reduce its effective width to 0.
const replacementDecoration = vscode.window.createTextEditorDecorationType({
opacity: '0',
letterSpacing: '-100px',
before: {
contentText: 'test',
}
})
https://code.visualstudio.com/api/references/vscode-api#DecorationRenderOptions

How to get hex code directly from jscolor?

I'm trying to build a canvas app with color picker using jscolor.
Here are what I've done:
Included the file jscolor.js
Created a button with class="jscolor"
Code for the button:
<button id="strokeCol" class="jscolor {valueElement:'color_value'}" onchange="config.changeStrokeCol(this.jscolor)">
Stroke Color
</button>
When I select a color from the picker I can see the background color of the button changing in developer tool, but in RGB value. Read it somewhere else that I can simply get the HEX by specifying $('element').val(), but in my case it just gives me "" (blank).
The HTML also has no value attribute triggered by the click, not to say being updated. The examples only shows that I can specify a default value (which can't be updated as well).
Have I missed anything? Or has jscolor been updated to provide only RGB value through the background color?
The only workaround I can think of is allowing the HEX code to be displayed inside the button then use .html() to get the value, but it seems so unnecessary.
Problem solved when class is inserted to the
<input> tag. Strange!

change part of the text color in UiBinder

I have a text:
<g:Label ui:field="titleLabel">text RedText someMoreText</g:Label>
Now I'd like to make RedText red. I can't set any widget inside <g:Label> tags, or html elements. But how is this done then?
One way is that you can use <g:InlineLable> inside your <g:Lable> and then style the InlineLable with color Red. Or you can use <span> element with an id/class as per requirement and style it accordingly to red color.

GWT text with different colors

I had a label that receives a text, example 12 Status 3
I need to put the numbers with a different color.
What is the best way to manage that?
thanks for the help
Every piece of text that you want to be a different color will need its own <Span> tag. This is how StackOverflow and other sites have formatted text inline. You could still use a single <Label> element though, and insert a series of tags.
For example:
/* CSS */
label { color:black; }
.red { color:red; }
.blue { color:blue; }
GWT:
myLabel.setInnerHTML("<span class='red'>12</span> Status <span class='blue'>3</span>");
You can't do this with a single label. You have to use three separate labels, and color each one independently. You probably want to use InlineLabel to keep them all on the same line - I think InlineLabel works just like a <span> tag.
The best way to color a label is with css or CssResource.