How can I apply token color changes to existing vscode color theme? - themes

I'm trying to make vscode theme by modifying existing color theme.
and having trouble with applying token color changes to existing theme.
I saw official guide of vscode(https://code.visualstudio.com/docs/getstarted/themes) and tried like below.
but lint says 'Property entity.name.function.member is not allowed.' and not applied to current workbench.
"workbench.colorCustomizations": {
"activityBar.background": "#2a2b30",
"[Darktooth]": {
"entity.name.function.member": "#347890"
}
},
I know there is a way to change editor with specifying all tokens, but I think using existing theme would save time.
Also I would like to apply color to some workbenches(workspace) not the entire editor.
"editor.tokenColorCustomizations": {
"comments": "#595436",
"strings": "#D5ECE2",
"functions": "#1ee9a5",
"textMateRules": [
{
"scope": "storage.modifier.ts",
"settings": {
"foreground": "#FFFFFF"
}
},
{
"scope":["entity.name.function.member", "meta.object-literal.key.js"],
"settings": {
"foreground": "#A1E2AA",
}
},
],
},

Related

Syntax coloring VSCode extension

I am trying to make an extension and need to colorize syntax for custom language. I was able to create extension using yo code and edit .tmLanguage.json file to match wanted syntaxes.
As for example in repository
"comment": {
"patterns": [
{
"name": "comment.line.semicolon",
"match": ";.*$"
}
]
},
However i have not been able to set custom color. Only way was to edit settings.json file using "editor.tokenColorCustomizations" and providing textMateRules.
Example:
For the pattern:
{
"name": "positioning.FMAX",
"match": "\\bFMAX\\b"
},
textMateRules
{
"name": "color.positioning.FMAX",
"scope": "positioning.FMAX",
"settings": {
"foreground": "#ff0000",
"fontStyle": "bold"
}
},
But this is not working when i hit F5 to test plugin. Because settings.json is not part of the extension.
I see in scope inspector.
textmate scopes positioning.FMAX
but foreground is
foreground No theme selector
comment.line.semicolon is working and coloring ;comments green
This doesn't work
{
"name": "positioning.FMAX",
"match": "\\bFMAX\\b",
"settings": {
"foreground": "#ff0000"
}
}
I just want simple way to color syntax like in setting.json. I have tried for more than week now. Any help much appreciated.
look at vscode-extension-samples repo:
https://github.com/microsoft/vscode-extension-samples/tree/main/theme-sample
You can describe your colors in json or tmTheme file and set it in package.json in contributes.themes. When debbugging started make sure that your custom theme selected as current for VSCode

CircleCI-Slack integration formatting is not working as it used to be

After an upgrade to slack api, the formatting of circle-ci messages into slack channels is not working properly. I am trying to see what i can do in the config.yaml file to add some colour to it, i am a novice so thought this would be a small task i could take on from the dev team, but I've hit a roadblock
Is there a better way to format this
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "View Job"
},
"url": "${CIRCLE_BUILD_URL}"
}
]
Adding emoji: true doesn't really change anything, is there a way to change the formatting of the text and to print out better descriptive messages in a fail and a pas scenario?
If you want to use emojis in your build, besides adding emoji: true you need to add the emojis at the text too. I'll share an example, feel free to edit it.
{
"text":"CircleCI job succeeded!",
"blocks":[
{
"type":"header",
"text":{
"type":"plain_text",
"text":"Deployment Successful! :tada:",
"emoji":true
}
},
{
"type":"section",
"fields":[
{
"type":"mrkdwn",
"text":"*Project*: $CIRCLE_PROJECT_REPONAME"
},
{
"type":"mrkdwn",
"text":"*When*: $(date +'%m/%d/%Y %T')"
},
{
"type":"mrkdwn",
"text":"*Tag*: $CIRCLE_TAG"
}
],
"accessory":{
"type":"image",
"image_url":"https://assets.brandfolder.com/otz5mn-bw4j2w-6jzqo8/original/circle-logo-badge-black.png",
"alt_text":"CircleCI logo"
}
},
{
"type":"actions",
"elements":[
{
"type":"button",
"text":{
"type":"plain_text",
"text":"View Job"
},
"url":"${CIRCLE_BUILD_URL}"
}
]
}
]
}
See the first text block, there is a :tada emoji, also the message is separated into blocks, see the screenshot of this config:

Extend slack bot menu color bar across full message (node, slack block kit, slack api)

I have a slack bot that uses a menu drop down, and it has a color bar on the side.
See the screenshot of what I have
here in the green circle
I want the bar to extend the whole message like this image
Note: This image is edited to show the example of the red bar (and because the actual slack bot message isn't important)
My code has something like
let slackPost = {
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": myText
}
} // ... some other blocks
],
"attachments": [
{
"text": menuTitle,
"color": menuBarColor,
"attachment_type": "default",
"actions": [
{
"name": menuName,
"text": menuPlaceHolder,
"type": "select",
"options": menuOptions
}
]
}
]
}
The new slack blocks layout doesn't allow the old color attachments property. You can find official documentation here.
There is one exception, and that's the color parameter, which currently does not have a block alternative. If you are strongly attached (🎺) to the color bar, use the blocks parameter within an attachment.
You can nest blocks inside the attachment property, like this:
let slackPost = {
"attachments": [{
"color": message.color,
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": myText
}
} // ... some other blocks
]
}]

Merge profile based on 2 property in Apache-Unomi

I am trying to build an customize logic in action for profile merging, can anybody suggest me how to create a rule where I can merge profile based on email and phone-number, as of now I am able to do with only one property value email. you can find the sample rule below in code :
"metadata": {
"id": "exampleLogin",
"name": "Example Login",
"description": "Copy event properties to profile properties on login"
},
"condition": {
"parameterValues": {
"subConditions": [
{
"type": "eventTypeCondition",
"parameterValues": {
"eventTypeId": "click"
}
}
],
"operator": "and"
},
"type": "booleanCondition"
},
"actions": [
{
"parameterValues": {
"mergeProfilePropertyValue": "eventProperty::target.properties(email)",
"mergeProfilePropertyName": "mergeIdentifier"
},
"type": "mergeProfilesOnPropertyAction"
},
{
"parameterValues": {
},
"type": "allEventToProfilePropertiesAction"
}
]
}
In order to be able to merge based on multiple identifiers you would have to extend the default built-in action to support that.
This can be done by creating a module but it will require some Java knowledge since this is how Unomi is implemented.
The code for the default merge action is available here:
https://github.com/apache/unomi/blob/master/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/MergeProfilesOnPropertyAction.java

kartograph svg map is empty when using "polygons" bounds mode

I 'm trying to generate svg maps from the GEOFLA shapefiles.
Using 'bbox' bounds mode with manually setting the bbox values works well :
{
"layers": [{
"id": "depts",
"src": "data/DEPARTEMENTS/DEPARTEMENT.shp",
"filter": {"CODE_REG": "24"},
"simplify": {
"method": "distance",
"tolerance": 8
},
"attributes": "all"
}],
"bounds": {
"mode": "bbox",
"data": [-4.5, 42, 8, 48],
},
"export": {
"width": 600,
"ratio": 0.8
}
}
But when setting the bounds mode to 'polygons', then i get an empty svg map :
{
"layers": [{
"id": "depts",
"src": "data/DEPARTEMENTS/DEPARTEMENT.shp",
"filter": {"CODE_REG": "24"},
"simplify": {
"method": "distance",
"tolerance": 8
},
"attributes": "all"
}],
"bounds": {
"mode": "polygons",
"data": {
"layer": "depts"
},
"padding": 0.06
},
"export": {
"width": 600,
"ratio": 0.8
}
}
I had a look in kartograph files and i noticed that the "get_features" method in "map.py" return a Polygon which coordinates doesn't intersect with the features geometry previouly extracted from the shapefile.
Then, each feature are throw away in the "get_features" method of the "maplayer.py" file when checking if feature geometry intersects with the "layer.map.view_poly" property.
I had a similar problem using GEOFLA file projection.
The solution I've found is basically to change my shapefile projection using QGIS. My idea was to use the projection of the shapefile given in installation guide which worked for me.
Get example shape file from kartograph installation page
Load this vector layer in QGIS Add your GEOFLASH layer in QGIS
Right-click on GEOFLASH layer and "Save as..." menu
In the save window, give a new name for your layer (eg : DEPARTEMENT_WGS84.shp)
Click CSR button and select the test layer projection (WGS 84 / EPSG:4326)
Click OK
Check the new shape file has correct projection :
cat DEPARTEMENT_WGS84.prj
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
Now your script should work fine using new shape file.

Resources