How to change brackets highlighting from underline? [duplicate] - sublimetext

This question already has answers here:
How to change style of matched brackets in Sublime Text 2 / 3?
(6 answers)
Closed 6 years ago.
For now open and close brackets { } highlights as underline _
I don't like it
But I can't find, is there way to change it to bolding or / and background change as in most of other editors?

Take a look at the BracketHighlighter plugin.
Edit
Try this for your Packages/User/bh_core.sublime-settings
{
// Define region highlight styles
"bracket_styles": {
// "default" and "unmatched" styles are special
// styles. If they are not defined here,
// they will be generated internally with
// internal defaults.
// "default" style defines attributes that
// will be used for any style that does not
// explicitly define that attribute. So if
// a style does not define a color, it will
// use the color from the "default" style.
"default": {
"icon": "dot",
// BH1's original default color for reference
// "color": "entity.name.class",
"color": "brackethighlighter.default",
"style": "underline"
},
// This particular style is used to highlight
// unmatched bracekt pairs. It is a special
// style.
"unmatched": {
"icon": "question",
// "color": "brackethighlighter.unmatched",
"style": "outline"
},
// User defined region styles
"curly": {
"icon": "curly_bracket",
// "color": "brackethighlighter.curly",
"style": "full"
},
"round": {
"icon": "round_bracket",
// "color": "brackethighlighter.round",
"style": "full"
},
"square": {
"icon": "square_bracket",
// "color": "brackethighlighter.square",
"style": "full"
},
"angle": {
"icon": "angle_bracket",
// "color": "brackethighlighter.angle",
"style": "full"
},
"tag": {
"icon": "tag",
// "color": "brackethighlighter.tag",
"style": "outline"
},
"single_quote": {
"icon": "single_quote",
// "color": "brackethighlighter.quote",
"style": "full"
},
"double_quote": {
"icon": "double_quote",
// "color": "brackethighlighter.quote",
"style": "full"
},
"regex": {
"icon": "regex",
// "color": "brackethighlighter.quote",
"style": "full"
}
}
}

Just go "Sublime Text -> Preferences -> Package Settings -> Bracket Highlighter -> Bracket Setting - User".
Then paste the following configuration and press "Save". That should fix it.
{
"bracket_styles": {
"default": {
"icon": "dot",
"color": "brackethighlighter.default",
"style": "none"
},
"unmatched": {
"icon": "question",
"style": "outline"
},
"curly": {
"icon": "curly_bracket"
},
"round": {
"icon": "round_bracket"
},
"square": {
"icon": "square_bracket"
},
"angle": {
"icon": "angle_bracket"
},
"tag": {
"icon": "tag"
},
"c_define": {
"icon": "hash"
},
"single_quote": {
"icon": "single_quote"
},
"double_quote": {
"icon": "double_quote"
},
"regex": {
"icon": "regex"
}
}
}
p.s.
I'm aware that this is an old question - this is for reference!

Paste this to your Theme_of_choise.tmTheme next to other stuff in settings. And no there are no bracketBackground key :(
<key>bracketsForeground</key>
<string>#FF0000</string>
<key>bracketsOptions</key>
<string>foreground</string>
<key>bracketContentsForeground</key>
<string>#FF0000</string>
<key>bracketContentsOptions</key>
<string>foreground</string>

Related

Handling events in interactive Vega legends - race condtion

The linked chart contains only a legend and the legend works as follows:
clicking on a fruit name toggles it on and off
shift-clicking on a fruit name switches it ON and switches OFF all other fruit names
Legend display is controlled by two entities:
data set SELECTED remembers selected items
signal FILTERMODE toggles the type of the filter between include and exclude
Currently, if only one fruit name is ON, then a click on it switches it OFF (so all fruit names become OFF).
I would like to modify this behavior so that a click on the last enabled fruit name would switch everything ON.
(In other words - it would not be possible to deselect everything.)
In order to switch everything ON I only need to change the value of signal FILTERMODE to exclude. This is where I hit a snag.
I have tried the following in the signal definition:
"update": "event.shiftKey? 'include' : (length(data('selected'))? filtermode : 'exclude')",
This does not work. I am fairly sure this happens because of a race condition.
When I check for the length of data('source'), it is still non-empty.
So the sequence of events is the following:
click
update signal FILTERMODE (check if the data set SELECTED is empty - it is not)
update data set SELECTED (only now it has become empty)
What would be the most elegant work-around?
Try this instead. It is the same as your code but also checks the length of the array which your single line doesn't currently do.
You can now shift click melon and then click it normally and the filter mode will switch.
Editor
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"description": "A scatter plot example with interactive legend and x-axis.",
"width": 200,
"height": 200,
"padding": 5,
"autosize": "pad",
"signals": [
{
"name": "shift",
"value": false,
"on": [
{
"events": "#legendSymbol:click, #legendLabel:click",
"update": "event.shiftKey",
"force": true
}
]
},
{
"name": "clicked",
"value": null,
"on": [
{
"events": "#legendSymbol:click, #legendLabel:click",
"update": "{value: datum.value}",
"force": true
}
]
},
{
"name": "filtermode",
"value": "exclude",
"on": [
{
"events": "#legendSymbol:click, #legendLabel:click",
"update": "event.shiftKey? 'include' : (length(data('selected') == 0)? filtermode : 'exclude')",
"force": true
}
]
}
],
"data": [
{
"name": "source",
"values": [
{"fruit": "apple"},
{"fruit": "plum"},
{"fruit": "pear"},
{"fruit": "melon"},
{"fruit": "grape"},
{"fruit": "strawberry"}
]
},
{
"name": "selected",
"on": [
{"trigger": "clicked && (event.shiftKey)", "remove": true},
{"trigger": "clicked && (event.shiftKey)", "insert": "clicked"},
{"trigger": "clicked && (!event.shiftKey)", "toggle": "clicked"}
]
}
],
"scales": [
{
"name": "color",
"type": "ordinal",
"range": {"scheme": "category10"},
"domain": {"data": "source", "field": "fruit"}
}
],
"legends": [
{
"stroke": "color",
"title": "Fruit",
"encode": {
"symbols": {
"name": "legendSymbol",
"interactive": true,
"update": {
"fill": {"value": "transparent"},
"strokeWidth": {"value": 2},
"opacity": [
{
"test": "filtermode == 'exclude' && !indata('selected', 'value', datum.value)",
"value": 1
},
{
"test": "filtermode == 'include' && indata('selected', 'value', datum.value)",
"value": 1
},
{"value": 0.15}
],
"size": {"value": 64}
}
},
"labels": {
"name": "legendLabel",
"interactive": true,
"update": {
"opacity": [
{
"test": "filtermode == 'exclude' && !indata('selected', 'value', datum.value)",
"value": 1
},
{
"test": "filtermode == 'include' && indata('selected', 'value', datum.value)",
"value": 1
},
{"value": 0.25}
]
}
}
}
}
]
}
Are you checking the length of the correct array? It is hard to understand precisely what the desired behaviour is but if I add the code (depending on whether filter mode is include or exclude)
length(data('selected')) == 6
or
length(data('selected')) == 0
then it seems to work.
Editor

Firefox: switch tabs with Alt + [0-9]

On Arch Linux I was able to switch tabs by pressing Alt+[tab_num].
I have to work on Windows, where firefox uses Ctrl+[tab_num].
It's really annoying. Ctrl is not very well positioned for this kind of switching + I am used to Alt+[tab_num] instead of Ctrl+[tab_num].
Is there an easy way how to manage/change this in Firefox ? Any extention that does exactly this ?
I was annoyed at this too, and made an addon to deal with it which you should be able to install from the official website.
Following the script in https://gist.github.com/zbraniecki/000268ea27154bbccaad190dd479d226. I write a working code(at least in my Firefox) below
manifest.json
{
"applications": {
"gecko": {
"id": "selecttab#braniecki.net",
"strict_min_version": "48.0"
}
},
"manifest_version": 2,
"name": "SelectTab Gnome Shortcut Override",
"version": "1.0",
"description": "An extension that overrides the default select-tab modifier key.",
"permissions": ["tabs"],
"background": {
"scripts": ["background.js"]
},
"commands": {
"selectTab1": {
"suggested_key": { "default": "Alt+1" },
"description": "Activate Tab 1"
},
"selectTab2": {
"suggested_key": { "default": "Alt+2" },
"description": "Activate Tab 2"
},
"selectTab3": {
"suggested_key": { "default": "Alt+3" },
"description": "Activate Tab 3"
},
"selectTab4": {
"suggested_key": { "default": "Alt+4" },
"description": "Activate Tab 4"
},
"selectTab5": {
"suggested_key": { "default": "Alt+5" },
"description": "Activate Tab 5"
},
"selectTab6": {
"suggested_key": { "default": "Alt+6" },
"description": "Activate Tab 6"
},
"selectTab7": {
"suggested_key": { "default": "Alt+7" },
"description": "Activate Tab 7"
},
"selectTab8": {
"suggested_key": { "default": "Alt+8" },
"description": "Activate Tab 8"
},
"selectTab9": {
"suggested_key": { "default": "Alt+9" },
"description": "Activate Tab 9"
}
}
}
backgroud.js
browser.commands.onCommand.addListener(async (command) => {
let num = parseInt(command.substr(9, 10)) - 1;
let tabs = await browser.tabs.query({currentWindow: true});
if (tabs.length < num) {
return;
}
if (num === 8) {
browser.tabs.update(tabs[tabs.length-1].id, {active: true});
} else {
browser.tabs.update(tabs[num].id, {active: true});
}
});
Then you may refer to How to publish a FireFox WebExtension for local installation only? to install it permanently.

Custom colors when generating a pie chart from JSON

I'm trying to create a pie chart with a custom set of colours using Am4Charts and the createFromConfig method.
I've followed the tutorial here but the chart keeps appearing with it's default color set.
Here is a sample of the JSON I've tried:
"innerRadius": 100,
"colors": {"list": ["#ff0000", "#00ff00", "#0000ff" ]},
"data": {
"0": {
"pot": "Within 8 days",
"value": "£111,119.70",
},
"1": {
"pot": "9 - 17 days",
"value": "£225,537.73"
},
"2": {
"pot": "18+ days",
"value": "£720,279.85"
}
},
"legend": [],
"xAxes": [
{
"type": "CategoryAxis",
"title": {
"text": "pot"
},
"dataFields": {
"category": "pot",
"title": {
"text": "Month"
}
},
"renderer": {
"labels": {
"rotation": 190,
"verticalCenter": "middle",
"horizontalCenter": "left"
}
}
}
],
"series": [
{
"type": "PieSeries",
"dataFields": {
"value": "value",
"category": "pot"
},
"ticks": {
"disabled": true
},
"labels": {
"disabled": true
},
}
],
Can somebody see where I've gone wrong?
Update 2:
Fixed in 4.0.0-beta.85.
Make sure you clear your browser cache after upgrading. And feel free to contact us again if you are still experiencing this issue.
Update 1:
Response from amchart contributor/CTO Martynas Majeris (https://github.com/martynasma):
Looks like there are two issues: documentation is wrong and there's a bug that prevents it from working :)
I updated the docs. It should say this:
{
// ...
"series": [{
// ...
"colors": {
"list": [
"#845EC2",
"#D65DB1",
"#FF6F91",
"#FF9671",
"#FFC75F",
"#F9F871"
]
}
}]
}
Also, fixed bug in dev version. New version will be released within 1-2 days.
Original
This might be a bug and I have opened an issue on amchart github. I will update this once I get a response: https://github.com/amcharts/amcharts4/issues/577
By the way, I do think your configuration JSON has couple issues:
data is an array, not an object
legend is an object, not an array
This is what I used to create the pie chart demo for the opened issue:
// Create chart instance in one go
let chart = am4core.createFromConfig({
"colors": {
"list": ["#ff0000","#00ff00", "#0000ff"]
},
// Create pie series
"series": [{
"colors": ["#ff0000","#00ff00", "#0000ff"],
"type": "PieSeries",
"dataFields": {
"value": "value",
"category": "pot"
}
}],
// Add data
"data": [{
"pot": "Within 8 days",
"value": "£111,119.70"
}, {
"pot": "9 - 17 days",
"value": "£225,537.73"
}, {
"pot": "18+ days",
"value": "£720,279.85"
}],
// Add legend
"legend": {},
"innerRadius": 100
}, "chart", am4charts.PieChart);

Setting "Additional Field Options" for thumbnails in Voyager

I would like to use thumbnails in my blog posts. In the Post-model I need to write this:
use TCG\Voyager\Traits\Resizable;
class Post extends Model
{
use Resizable;
}
Then there is an other settings piece:
{
"resize": {
"width": "1000",
"height": null
},
"quality" : "70%",
"upsize" : true,
"thumbnails": [
{
"name": "medium",
"scale": "50%"
},
{
"name": "small",
"scale": "25%"
},
{
"name": "cropped",
"crop": {
"width": "300",
"height": "250"
}
}
]
}
Where does the settings part go?
And, how do I generate the thumbnails after that?
Sources:
https://voyager.readme.io/docs/thumbnails-url
https://voyager.readme.io/docs/additional-field-options#section-image
Settings should be written in the BREAD page for your table in front of the image form field.

Vega-lite bar chart space between bars

D3 newbie.
How I adjust the spacing between bars in vega-lite bar chart and override the default? binSpacing I think only works on histograms. See code below.
I'll want to adjust colour of text and font family too... But am having trouble finding it in the docs.
{
"$schema": "https://vega.github.io/schema/vega-lite/v2.json",
"width": 1200,
"height": 900,
"data": {
"url": "data/seattle-weather.csv"
},
"mark": "bar",
"encoding": {
"x": {
"aggregate": "count",
"type": "quantitative"
},
"size": {
"value": 40
},
"y": {
"field": "date",
"type": "temporal",
"timeUnit": "month",
"axis": {
"title": "Regions"
}
},
"color": {
"field": "weather",
"type": "nominal",
"scale": {
"domain": [
"0-20 days",
"21-27 days",
">28 days"
],
"range": [
"red",
"orange",
"green"
]
},
"legend": {
"title": "Case Ageing"
}
}
}
}
I can understand your confusion. It seems there are three questions:
How do I change bin width for histograms? This is documented here. If you have trouble with a reproducible example, I will be happy to help.
How do I adjust the spacing of the bars? This is controlled by padding, paddingInner and paddingOuter all documented at the encoding level and at the config level. You might be having trouble since you are setting size manually with "size": {"value": 40}, but I am guessing this is a remnant from experimenting. Here is a working spec from this gist. You can play with paddingOuter, paddingInner, or add padding to apply to both inner and outer.
How do I change font styling? See this gist.

Resources