Where can vscode view the default colors for parts that you don't define - visual-studio-code

I sometimes wonder what vscode's default widget color is. For example: when I use a github theme, I find that it only defines one part of the color internally, so where is the other part defined, and how do I view it.
For example, when I look at the color scheme of the topic by Developer : generator color theme... command, the undefined part is always shown in the form of comments(e.g "activityBar.activeBackground": null,). How can I see the color of this annotated section?

Related

VSCode API: Access the minimap

Is there any way to access the "minimap" that optionally appears next to the scroll bar on the right hand side of the editor?
Preferably I would like to access that panel's width in pixels.
The best I could do to get the values I want is to read the current editor configuration (also settable from the vscode settings UI/JSON).
const editorConfig = vscode.workspace.getConfiguration('editor');
const minimapOn = editorConfig.get("minimap.enabled");
const minimapWidth = editorConfig.get("minimap.maxColumn");
But this only lists the maximum width, not the current one.
Configuring the Width of the Editor's Minimap
The Minimaps with is configurable, not by pixels, but by characters.
The reason it is configurable by characters is because it gives developers a way of setting the minimap's width to the exact width that there longest lines of code are. This is beneficial, as it makes the minimap as wide as needed, without taking up any unnecessary space.
Below is the setting that changes the width of the editor's minimap.
// #file Globally Scoped "settings.json" file
{
"editor.minimap.maxColumn": 75
}
75 can be set to any amount of characters you choose.
Now the part about the API
Anytime you have a setting that does what you want, you can use the API to apply it to your extension. I don't want to continue explaining anything byond the scope of this question, so I will provide a link to the documentation that covers the method used to change a setting using the VS Code API, and a snippet showing you how to use the method to change the minimap's columns width.
Below shows the code an extension might include to change the size of the minimap.
await vscode.workspace
.getConfiguration()
.update(
'editor.minimap.maxColumn',
100,
vscode.ConfigurationTarget.Global
);
NOTE: I wrote the example above off the top of my head. I know that the semantics are all correct, but you will probably have to play with it to get it to do exactly what it is your going for.
Here are a couple links to help you understand what your doing.
"vscode.workspace.getConfiguration()" This is can be interpreted as the base of program-interface that changes settings. From this part of the API, a few methods, objects, constants, and events extend, all of which are used to set, get, and mutate configurations within VS Code.
"The Configuration target" sets the settings.json file you are targeting. Global is a good bet, I prefer "workspace" (which is not the same as "workspace folder".

What is the best way to add colors to Material-UI more than Primary/Secondary?

I've looked through the documentation. I've scoured YT for tuts and googled to no avail. Maybe this is just beyond the scope of MUI, but it seems really counter-productive.
I'm just looking for a non-hacky, semantically-correct way of having my color palette defined where components can access the different colors (I know the color prop needs a wrapper, but even a style with the color var is ok to me for this).
My color object is as follows:
const colors = {
cultured: '#FCFAF9',
darkGray: '#333333',
turquoise: '#48E5C2',
unbleachedSilk: '#F3D3BD',
mediumGray: '#5e5e5e'
}
What I'm hoping to achieve is to use the primary/secondary palettes for most of it, but for pop colors, or decorations, I wanted to add more colors to the palette without using a semantically-wrong palette object (for instance, using 'error' to set a color, when the object doesn't really represent an error).
Are you really relegated to only two main colors with MUI? How are you guys defining 5 colors to use in a way that doesn't break logic?
My idea (pseudo-code):
<Button onClick={() => doSomething} color={{colors.mediumGray}} or style={{backgroundColor: colors.mediumGray}}>
Button
</Button>
After consulting with the repo, it appears that Material UI v5 fixes this issue, and using one of the workarounds is the only way to do it until v5 becomes a stable release (they said sometime in 2021).

How to get standard system colours for custom widget

I am writing a custom widget using gtkmm and I would like to use the standard selection colour when part of my widget is selected. For example when you select text in a text box, the background colour goes (for me) dark blue, so I want to obtain this same dark blue colour.
I have tried this, but I only get black or white, not the actual colours in use:
bool MyWidget::on_draw(const Cairo::RefPtr<Cairo::Context>& cr) {
Gdk::Cairo::set_source_rgba(cr,
get_style_context()->get_color(Gtk::STATE_FLAG_SELECTED));
}
What is the correct way to obtain the standard colours with gtkmm, such that if the user changes their colour theme, the changes will also be reflected here?
Or is it considered best practice to define some new CSS styles which inherit from the standard system ones, so that people can override colours for just my widget if they desire, without affecting others?
Turns out the answer to this is that what I was doing in the question was correct, except there were no styles applied to the widget so the colours were just black and white.
I had to add this in the widget's constructor:
this->get_style_context()->add_class(GTK_STYLE_CLASS_ENTRY);
To get text entry styles. Of course this made render_background() as suggested by ebassi render a text entry background instead, which isn't what I wanted (I just wanted a solid colour.) So instead I changed the above line (in the constructor) to:
this->get_style_context()->add_class(GTK_STYLE_CLASS_DEFAULT);
And in my render function, temporarily set text-entry styles just to get the colour:
auto cxStyle = this->get_style_context();
cxStyle->context_save();
cxStyle->add_class(GTK_STYLE_CLASS_ENTRY);
Gdk::Cairo::set_source_rgba(cr, cxStyle->get_background_color(Gtk::STATE_FLAG_SELECTED));
cr->fill();
cxStyle->context_restore();
This way I was able to obtain the text selection colour and fill a rectangle behind the area of my custom widget that should be shown as currently selected.
I couldn't use render_background() here because it would have drawn the background of a text control which I don't want, I just wanted a solid filled rectangle.
The proper way to render the background of a widget is to use gtk_render_background(). This function will take into account widget state and style.
Your code above becomes:
bool
MyWidget::on_draw (const Cairo::RefPtr<Cairo::Context>& cr)
{
double w = get_allocated_width(), h = get_allocated_height();
Glib::RefPtr<Gtk::StyleContext> context = get_style_context();
context->render_background(cr, 0, 0, w, h);
return true;
}
This way your widget will always be updated to reflect the theme.
If you want to control the color and style of your widget you should use an additional Gtk::StyleProvider for your application to load a custom CSS fragment with the desired style classes.

Reference for phClr in openxml

I am trying to find value for phClr, but no results.
Slide master is not having mapping for phClr.
I am aware that phClr is just a passed-in color value, but what exactly is its color reference?
Is it bg2 or anything else?
http://msdn.microsoft.com/en-us/library/cc964302(v=office.12).aspx
Blockquote
The scheme color value is set to placeholder color (the value phClr). This value appears throughout the fill, line, effect, and background styles and indicates that the settings are applied to the theme color applicable for a given style. This allows the same fill, line, and effect styles to populate across the theme colors that appear in the OfficeArt galleries.
“phClr” is a kind of placeholder color

programmatically change the background color in eclipse

I have a question related to eclipse plugin development. Is there any means
by which I can programmatically change the background color in eclipse.
I am able to change the text foreground color by calling
setTextColor(color, offset, length, controlRedraw) in ITextViewer
but I don't find any function by which I can change the background
color of the text.
If anyone has been through this kindly share your thoughts.
Thanks
arav
I am not sure this can be done easily, short of extending your own version of a Text Editor, here you provide a Configuration Class which inturn accepts a PresentationReconciler Class which is like a Rule Class that tells you if you need to put a Foreground or a Background Color
See this document
PresentationReconciler
IPresentationDamager: define dirty region given a text change
IPresentationRepairer: recreate presentation for dirty region
DefaultDamagerRepairer does both, based on a token scanner
ITokenScanner: parse text into a token stream
RuleBasedScanner uses simple rules
Extract from the presentation
From Text Editor Recipes, Season’s recipes for your text editor
Tom Eicher, IBM Eclipse Team
Here, the null background color means, takes the default system background for that widget. (so here: white).
But you could specify whatever color you want, based on the partitioning of your document and on the rules that would apply.
I know this was asked a while ago, but in case anyone is looking for another solution, I thought I would post the following:
Since you are able to use the setTextColor method, then you should be able to use the changeTextPresentation method as well.
In the case of my plug-in, I have a TextListener that calls the TextChanged method I overwrote. I did the following to add background color using the changeTextPresentation method. In doing so, I was able to get a Green background with Black foreground. Not that I would want this, of course, but just for testing purposes.
public void TextChanged(TextEvent event){
...
TextPresentation presentation = new TextPresentation();
TextAttribute attr = new TextAttribute(new ColorManager().getColor(MyConstants.BLACK),
new ColorManager().getColor(MyConstants.GREEN), style);
presentation.addStyleRange(new StyleRange(startOffset, tokLength, attr.getForeground(),
attr.getBackground());
sourceViewer.changeTextPresentation(presentation, true); //sourceViewer is a global variable passed to my TextListener class constructor.
}