Skip to content

Instantly share code, notes, and snippets.

@ebrelsford
Created August 27, 2013 01:17
Show Gist options
  • Save ebrelsford/6348642 to your computer and use it in GitHub Desktop.
Save ebrelsford/6348642 to your computer and use it in GitHub Desktop.
CartoCSS for a neon sign effect as used in http://cdb.io/15ekzYE
@occurrences0inner: #5EF2F4;
@occurrences0outer: #272BB3;
@occurrences1inner: #FAFEFE;
@occurrences1outer: #07A40B;
@occurrences2inner: #FFE721;
@occurrences2outer: #95521E;
@occurrences3inner: #EFFC40;
@occurrences3outer: #D71208;
/*
* Common text properties
*/
#sign_application_filings::outer,
#sign_application_filings::inner {
text-name: [text_on_sign];
text-face-name: "DejaVu Sans Book";
/* Wrapping */
text-wrap-width: 20;
text-ratio: 0;
/* Tilt and placement */
text-orientation: [rotation] / 3;
text-placement-type: simple;
text-allow-overlap: true;
/* Spacing */
text-line-spacing: -2;
text-character-spacing: 1;
}
/*
* Text sizes
*/
#sign_application_filings::outer,
#sign_application_filings::inner {
[zoom <= 10] {
text-size: 4;
}
[zoom <= 12] {
text-size: 10;
}
text-size: 15;
[zoom >= 15] {
text-size: 20;
}
}
#sign_application_filings::outer {
text-halo-radius: 5;
[zoom <= 13] {
text-halo-radius: 3;
}
[zoom <= 11] {
text-halo-radius: 1;
}
text-opacity: 0.6;
/*
* Halo and fill colors based on
* number of occurrences
*/
text-halo-fill: @occurrences0outer;
text-fill: @occurrences0outer;
[text_occurrences > 2] {
text-halo-fill: @occurrences1outer;
text-fill: @occurrences1outer;
}
[text_occurrences > 4] {
text-halo-fill: @occurrences2outer;
text-fill: @occurrences2outer;
}
[text_occurrences > 6] {
text-halo-fill: @occurrences3outer;
text-fill: @occurrences3outer;
}
}
#sign_application_filings::inner {
/*
* Fill colors based on number of
* occurrences
*/
text-fill: @occurrences0inner;
[text_occurrences > 2] {
text-fill: @occurrences1inner;
}
[text_occurrences > 4] {
text-fill: @occurrences2inner;
}
[text_occurrences > 6] {
text-fill: @occurrences3inner;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment