How do I show database info in a map pin? - css

I created a map using mapbox of team member locations per state for my company. The number of team members by state ranges from 1 - 10. The map pin (marker) symbols only go to nine.
I started to mess with Tilemill and saw a post saying it is possible to put the numbers inside of the markers, https://www.mapbox.com/tilemill/docs/guides/advanced-map-design/ (scroll to 'Text Labels' section, it is exactly what I am trying to do).
The database column with the numbers I want is called 'marker-symbol'. Here is the code so far in the default styles.mss:
Map {
background-color: #b8dee6;
}
#countries {
::outline {
line-color: #85c5d3;
line-width: 2;
line-join: round;
}
polygon-fill: #fff;
}
#features {
marker-width:20;
marker-fill:#f45;
marker-line-color:#813;
marker-allow-overlap:true;
}
Any help is greatly appreciated!
Thank you.

I actually had it right in some of the code I was testing. I just put the code in the wrong spot so it was behind the marker instead of in front of it. Here is the fix:
Map {
background-color: #b8dee6;
}
#countries {
::outline {
line-color: #85c5d3;
line-width: 2;
line-join: round;
}
polygon-fill: #fff;
}
#features {
marker-width:20;
marker-fill:#f45;
marker-line-color:#813;
marker-line-opacity:2;
marker-allow-overlap:true;
::labels {
text-name:"[marker-symbol]";
text-face-name:"Arial Bold";
text-allow-overlap:true;
}
}

Related

AgGrid Customized (Selected) Row Styling

I am trying to add customized styling to every second row in my AgGrid.
I am using the following snippet of code in my onGridReady:
gridOptions.getRowStyle = function (params) {
if (params.node.rowIndex % 2 === 0) {
return { background: "#f0f1f4" };
};
The issue I am having is I would like to add a variation indicating whether the row is selected or not. Currently the style remains the same either way.
What should I add to my code to achieve this?
Thank you in advance for reading and responding.
AgGrid exposes multiple class names of each row elements to describe its current state (ag-row, ag-row-odd, ag-row-selected...). You can take advantage of that information to override the row style if it's currently selected like below:
.ag-theme-alpine .ag-row.ag-row-odd {
background-color: pink;
}
.ag-theme-alpine .ag-row.ag-row-odd.ag-row-selected {
background-color: red;
}
Live Demo

Get value from a list of properties / map

Currently, I've a list of colors (for example):
#colors: {
base: #716aca;
brand: #716aca;
danger: #c14549;
warning: #ffb822;
success: #34bfa3;
primary: #5867dd;
black: #000000;
}
I have each function that iterates over all the colors and makes all the possible rule colors that we can use:
each(#colors, .(#value, #key, #index) {
.rules-here-#{key} {
attribute: #value;
}
}
What I can't make work is something like this:
.getColor(#color);
Where I would use on other places, like:
div.system-warning-notification {
background-color: .getColor('base');
color: .getColor('danger');
}
I have no idea if this is even possible. I have been losing my mind over this for over a week now without any progress.
If that isn't possible, can I generate the variables so I can access them like:
#color-base: #716aca;
Without having to manually create them?
Thank you very much and I hope I asked this right. I am new here.

Atom Editor, change color of function call

currently I am trying to "hack" my Atom-editor and I am stuck here: I want to change the color of whenever I call a function in python - just like it is in the basic setup of SublimeText3. I am using the following code in my styles.less:
atom-text-editor::shadow {
.meta.function-call.python {
color: red;
}
}
The Problem is that this code also changes the color of all instances & modules to red leaving me with this mess here: URL
atom-text-editor.editor {
.syntax--meta.syntax--function-call.syntax--generic {
color: #66D9EF;
}
}
This works for me using magicpython.
Screenshot
Try this:
atom-text-editor .syntax--function-call {
color: red;
}
Edit: Fixed as per first comment.

Dynamic Variable Names with Less

I'm trying to assign some dynamic variable names using less (using it for the first time) ... but nothing I've tried seems to work. After looking through all the documentation, I came up with this, but it's still not working:
// jellybeans
#opacity: 1;
#black-jellybeans: rgba(59,59,59,#opacity); // #3b3b3b
#red-jellybeans: rgb(207,106,76,#opacity); // #cf6a4c
#green-jellybeans: rgba(153,173,106,#opacity); // #99ad6a
#yellow-jellybeans: rgba(216,173,76,#opacity); // #d8ad4c
#blue-jellybeans: rgba(89,123,197,#opacity); // #597bc5
#magenta-jellybeans: rgba(160,55,176,#opacity); // #a037b0
#cyan-jellybeans: rgba(113,185,248,#opacity); // #71b9f8
#white-jellybeans: rgba(173,173,173,#opacity); // #adadad
// the palette to use
#palette: "jellybeans";
#black: "black-#{palette}";
#red: "red-#{palette}";
#green: "green-#{palette}";
#yellow: "yellow-#{palette}";
#blue: "blue-#{palette}";
#magenta: "magenta-#{palette}";
#cyan: "cyan-#{palette}";
#white: "white-#{palette}";
Any suggestions?
use:
#cyan: "cyan-#{palette}";
p{
color: ##cyan;
}
or
#whitename: "white-#{palette}";
#white: ##whitename;
p{
color: #white;
}

Less syntax with ## meaning

I have downloaded a theme for bootstrap and In their less sources I have a mixin like:
.label-color(#color) {
#label-class:~"label-#{color}";
#badge-class:~"badge-#{color}";
#label-color:##label-class;
.#{label-class}, .#{badge-class} {
background-color:#label-color !important;
}
}
.label-arrow(#color) {
#label-class:~"label-#{color}";
#label-color:##label-class;
.#{label-class}{
&.arrowed:before {
border-right-color:#label-color;
}
&.arrowed-in:before {
border-color:#label-color;
}
&.arrowed-right:after {
border-left-color:#label-color;
}
&.arrowed-in-right:after {
border-color:#label-color;
}
}
}
.label-color(~"lime");
.label-color(~"red");
My problem is that #label-color:##label-class;
because my internal compiler less4j give me error at this double ## and I don't understand why. Local compiler Crunch is working and know to compile that so is not a wrong syntax.
Can someone give me a hint pls, ty.
As already mentioned by #deceze, you can read at http://lesscss.org/features/#variables-feature-variable-names that the double # will be use to create a variable variable name in Less:
For instance:
#red: darkred;
#color: "red";
p {
color: ##color;
}
Outputs:
p {
color: darkred;
}
Notice that the variable name (#color) should be a string.
The above should also work in less4j according the docs which can be found at: https://github.com/SomMeri/less4j/wiki/Less-Language-Variables:
If the variable contains a string, then it can act as a reference to
another variable.

Resources