adding custom palette to mui theme gives syntax error - material-ui

I try to simply add a new palette to my MUI Theme and get the following type error:
Any help or hint?

you are not creating a new palette what I see in the image is that you are trying to overwrite the existing palette object by adding a new property 'custom' but this is not possible! the interface PaletteOptions does not have a property 'custom'.
if you want to use another palette you just have to replace the existing palette object with your new custom one.

Related

how can i set a custom icon dependent on the filename and not extension in vscode?

i have installed a new icon theme for vscode called vscode-icnos, and i am trying to
set the todo icon if a file is [todo, TODO, *.todo, *.TODO],
i have done this for the *.todo and *.TODO, but cannot fin a way to set it on the filename, not the extension, any help
this works in the normal vscode icon seti, but not in my custom
any help
https://medium.com/#chih.hsi.chen/how-to-add-your-custom-icons-to-vscode-icons-9ab8c3f9abc1
Here is shown how to do it step-by-step

How do I capture "Find" command in vscode custom editor extension?

I'm creating a custom editor document extension for vscode and I want to have a custom find widget that will suit what I'm doing in my document. How do I capture the find event and execute some code. I tried registering a command for "actions.find" but this made other tabs not able to use the find command. Is there an easy way to do this?

vscode api: how to get icons from File Icon Theme

I am writing an extension for VSCode. In WebviewPanel I need to display the file extension icon which is from the File Icon Theme. Is there a function to get icons from file icon theme?
I'm also researching this. I don't have an answer yet, but have some clues so far. Hope this helps:
https://code.visualstudio.com/api/references/vscode-api#ThemeIcon
A reference to a named icon. Currently, File, Folder, and ThemeIcon
ids are supported.
So if you have a file/folder id you can create an instance of ThemeIcon with its constructor
CONSTRUCTORS
new ThemeIcon(id: string, color?: ThemeColor): ThemeIcon
How to get file and folder ids? Looks like it's through file associations defined in file icon themes. See vscode API for file icon theme / file association
So how to get that associations?
I can get the name of the current icon theme from codes below
const config = vscode.workspace.getConfiguration();
console.log(config.workbench.iconTheme); // output "vs-seti"
The seti theme is an internal extension, I can get it by
const ext = vscode.extensions.getExtension("vscode.vscode-theme-seti")
console.log(ext.packageJSON.contributes.iconThemes[0].id) // 'vs-seti'
And I can further get the theme JSON by
const themePath = path.join(ext.extensionPath, ext.packageJSON.contributes.iconThemes[0].path);
Then I can read that JSON file, use it to associate file/directory name to file/directory id, then to get the icon......
Today's report:
The built-in seti file icon extension's JSON is at here
In "fileExtensions" there is no mapping of language file extensions (like .ts). For programming language source codes, needs to first find languageId, then map to icons in "languageIds" section
Tried to find the file extension to language ID mappings in "files.associations" configurations but failed.
Then find out I can loop through all extensions (vscode.extensions.all) and check their package.json to find language contributes. Associated file extensions are defined in language contributes. So now I can map from file extension to language ids.
Then I tried const icon = new vscode.ThemeIcon(langIconId); but the icon is not as expected. Instead of the typescript icon I was expecting it's the error icon... ThemeIcon mentioned all icons can be found here so I guess it's not a ThemeIcon after all...
So the seti theme's JSON document contains a "iconDefinitions" section and it has the fontCharacter and fontColor of the icon. Now I can associate a file extension all the way to icon fontCharacter and fontColor.
However this is the end of it. I cannot set the tree-view to use it.
At the end I think I need to set the TreeItem's resourceUri to let vscode automatically determine the icon. See https://code.visualstudio.com/api/references/vscode-api#TreeItem.resourceUri

How to get the vscode theme color in vscode extensions?

I want to use some color used in current vscode theme in my extension. How do I get the colors?
In other words, I want to match the color of extension using original color with the base vscode windows in run-time of extension.
You can reference workbench colors:
const color = new vscode.ThemeColor('badge.background');
That will give you reference to the color of the current theme's badge.
Note, that you cannot reference TM scope items: #32813
https://code.visualstudio.com/docs/extensionAPI/vscode-api#_a-namethemecoloraspan-classcodeitem-id244themecolorspan
For accessing the theme color on the WebView context, there are css variables generated for all the theme colors. For example, for getting:
editor.background
You can use the css variable:
var(--vscode-editor-background)
When you have your desired color scheme in your VS Code instance, run the Developer: Generate Color Theme From Current Settings command. This will generate a color theme file that you can then publish in your own extension

Netbeans GUI editor: How to create a form with JScrollPane top level component?

The Netbeans GUI Editor offers "New -> JPanel form...", but how do I get a JScrollPane as top level component instead of the JPanel?
Of course, a JScrollPane could be put directly under a JPanel, but why using such an unnecessary level?
Yes! if you can follow these simple steps:
Let come in Tools->Templates->Swing GUI Forms
Duplicate the template "JPanel Form"
Rename the duplicate to "JScrollPane Form"
Open the duplicate in the editor
"javax.swing.JPanel" changed in "javax.swing.JScrollPane" ... save the file
Add a new Swing component to project (Wow! now on the list appear to us our new template file)
Chose this template and enjoy!