Skip to content

Instantly share code, notes, and snippets.

@LukeFinch
Created July 6, 2020 15:26
Show Gist options
  • Save LukeFinch/57a397c92e40369c9839af354f2bba0e to your computer and use it in GitHub Desktop.
Save LukeFinch/57a397c92e40369c9839af354f2bba0e to your computer and use it in GitHub Desktop.
Add a line break between categories in a JSON string.
{
"gradientDark010": "linear-gradient(90deg, rgba(48, 48, 48, 0) 0%, rgba(48, 49, 49, 1) 100%)",
"gradientLight010": "linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%)",
"overlayDark010": "overlayDark010",
"overlayDark020": "overlayDark020",
"overlayDark030": "overlayDark030",
"overlayDark040": "overlayDark040",
"overlayDark110": "overlayDark010",
"overlayDark120": "overlayDark020",
"overlayDark130": "overlayDark030",
"overlayDark140": "overlayDark040",
"overlayLight010": "overlayLight010",
"overlayLight020": "overlayLight020",
"overlayLight030": "overlayLight030",
"overlayLight040": "overlayLight040",
"overlayLight110": "overlayLight010",
"overlayLight120": "overlayLight020",
"overlayLight130": "overlayLight030",
"overlayLight140": "overlayLight040",
"amber010": "rgba(255, 227, 176, 1)",
"amber020": "rgba(255, 210, 132, 1)",
"amber030": "rgba(255, 192, 88, 1)",
"amber040": "rgba(255, 173, 44, 1)",
"amber050": "rgba(255, 153, 0, 1)",
"amber060": "rgba(255, 143, 0, 1)",
"amber070": "rgba(255, 130, 0, 1)",
"amber080": "rgba(255, 114, 0, 1)",
"amber090": "rgba(255, 96, 0, 1)",
"amber100": "rgba(255, 75, 0, 1)",
"black": "rgba(0, 0, 0, 1)",
"white": "rgba(255, 255, 255, 1)",
"blue010": "rgba(235, 245, 255, 1)",
"blue020": "rgba(195, 224, 255, 1)",
"blue030": "rgba(141, 195, 255, 1)",
"blue040": "rgba(91, 169, 255, 1)",
"blue050": "rgba(38, 142, 255, 1)",
"blue060": "rgba(0, 114, 238, 1)",
"blue070": "rgba(0, 86, 180, 1)",
"blue080": "rgba(0, 62, 129, 1)",
"blue090": "rgba(0, 48, 100, 1)",
"blue100": "rgba(0, 26, 54, 1)",
"green010": "rgba(220, 252, 220, 1)",
"green020": "rgba(137, 244, 137, 1)",
"green030": "rgba(0, 222, 0, 1)",
"green040": "rgba(0, 193, 0, 1)",
"green050": "rgba(0, 165, 0, 1)",
"green060": "rgba(0, 138, 0, 1)",
"green070": "rgba(0, 104, 0, 1)",
"green080": "rgba(0, 75, 0, 1)",
"green090": "rgba(0, 58, 0, 1)",
"green100": "rgba(0, 31, 0, 1)",
"neutral010": "rgba(243, 243, 243, 1)",
"neutral020": "rgba(220, 221, 221, 1)",
"neutral030": "rgba(190, 191, 191, 1)",
"neutral040": "rgba(165, 166, 166, 1)",
"neutral050": "rgba(141, 142, 142, 1)",
"neutral060": "rgba(117, 119, 119, 1)",
"neutral070": "rgba(88, 89, 89, 1)",
"neutral080": "rgba(62, 63, 63, 1)",
"neutral090": "rgba(48, 49, 49, 1)",
"neutral100": "rgba(25, 26, 26, 1)",
"purple010": "rgba(178, 195, 213, 1)",
"purple020": "rgba(147, 161, 195, 1)",
"purple030": "rgba(117, 124, 177, 1)",
"purple040": "rgba(93, 88, 159, 1)",
"purple050": "rgba(80, 59, 140, 1)",
"purple060": "rgba(71, 30, 121, 1)",
"purple070": "rgba(80, 25, 107, 1)",
"purple080": "rgba(84, 20, 93, 1)",
"purple090": "rgba(79, 16, 73, 1)",
"purple100": "rgba(64, 12, 48, 1)",
"red010": "rgba(251, 242, 240, 1)",
"red020": "rgba(242, 215, 211, 1)",
"red030": "rgba(231, 179, 172, 1)",
"red040": "rgba(221, 147, 138, 1)",
"red050": "rgba(211, 115, 103, 1)",
"red060": "rgba(208, 72, 55, 1)",
"red070": "rgba(178, 20, 0, 1)",
"red080": "rgba(129, 14, 0, 1)",
"red090": "rgba(101, 11, 0, 1)",
"red100": "rgba(57, 6, 0, 1)",
"fabulous010": "rgba(255, 240, 246, 1)",
"fabulous020": "rgba(255, 208, 227, 1)",
"fabulous030": "rgba(255, 163, 200, 1)",
"fabulous040": "rgba(255, 121, 175, 1)",
"fabulous050": "rgba(255, 65, 141, 1)",
"fabulous060": "rgba(234, 0, 94, 1)",
"fabulous070": "rgba(179, 0, 71, 1)",
"fabulous080": "rgba(130, 0, 52, 1)",
"fabulous090": "rgba(102, 0, 41, 1)",
"fabulous100": "rgba(59, 0, 24, 1)",
"football010": "rgba(237, 245, 242, 1)",
"football020": "rgba(202, 226, 217, 1)",
"football030": "rgba(155, 201, 183, 1)",
"football040": "rgba(113, 179, 153, 1)",
"football050": "rgba(73, 157, 124, 1)",
"football060": "rgba(32, 134, 98, 1)",
"football070": "rgba(34, 99, 73, 1)",
"football080": "rgba(25, 71, 52, 1)",
"football090": "rgba(19, 54, 41, 1)",
"football100": "rgba(10, 28, 22, 1)",
"money010": "rgba(249, 242, 245, 1)",
"money020": "rgba(236, 215, 225, 1)",
"money030": "rgba(219, 179, 198, 1)",
"money040": "rgba(205, 150, 175, 1)",
"money050": "rgba(191, 121, 152, 1)",
"money060": "rgba(182, 86, 128, 1)",
"money070": "rgba(145, 59, 97, 1)",
"money080": "rgba(103, 42, 70, 1)",
"money090": "rgba(79, 32, 53, 1)",
"money100": "rgba(42, 17, 28, 1)",
"motors010": "rgba(241, 243, 251, 1)",
"motors020": "rgba(215, 220, 243, 1)",
"motors030": "rgba(179, 189, 234, 1)",
"motors040": "rgba(149, 163, 226, 1)",
"motors050": "rgba(119, 137, 218, 1)",
"motors060": "rgba(91, 111, 211, 1)",
"motors070": "rgba(63, 82, 169, 1)",
"motors080": "rgba(44, 58, 119, 1)",
"motors090": "rgba(34, 44, 92, 1)",
"motors100": "rgba(18, 24, 48, 1)",
"news010": "rgba(238, 243, 250, 1)",
"news020": "rgba(205, 223, 241, 1)",
"news030": "rgba(160, 195, 229, 1)",
"news040": "rgba(121, 170, 219, 1)",
"news050": "rgba(83, 146, 208, 1)",
"news060": "rgba(58, 121, 187, 1)",
"news070": "rgba(43, 92, 140, 1)",
"news080": "rgba(31, 65, 99, 1)",
"news090": "rgba(24, 49, 76, 1)",
"news100": "rgba(12, 26, 40, 1)",
"showbiz010": "rgba(244, 242, 254, 1)",
"showbiz020": "rgba(224, 216, 252, 1)",
"showbiz030": "rgba(198, 181, 249, 1)",
"showbiz040": "rgba(177, 150, 247, 1)",
"showbiz050": "rgba(158, 119, 245, 1)",
"showbiz060": "rgba(139, 83, 241, 1)",
"showbiz070": "rgba(114, 36, 219, 1)",
"showbiz080": "rgba(81, 23, 160, 1)",
"showbiz090": "rgba(63, 16, 126, 1)",
"showbiz100": "rgba(34, 6, 74, 1)",
"sport010": "rgba(236, 245, 247, 1)",
"sport020": "rgba(199, 226, 230, 1)",
"sport030": "rgba(149, 199, 208, 1)",
"sport040": "rgba(105, 177, 189, 1)",
"sport050": "rgba(63, 154, 170, 1)",
"sport060": "rgba(37, 129, 145, 1)",
"sport070": "rgba(34, 97, 108, 1)",
"sport080": "rgba(25, 68, 77, 1)",
"sport090": "rgba(19, 52, 59, 1)",
"sport100": "rgba(10, 27, 31, 1)",
"tech010": "rgba(241, 243, 248, 1)",
"tech020": "rgba(211, 222, 235, 1)",
"tech030": "rgba(174, 193, 218, 1)",
"tech040": "rgba(142, 168, 203, 1)",
"tech050": "rgba(119, 144, 176, 1)",
"tech060": "rgba(98, 120, 149, 1)",
"tech070": "rgba(74, 89, 110, 1)",
"tech080": "rgba(52, 63, 79, 1)",
"tech090": "rgba(41, 48, 59, 1)",
"tech100": "rgba(22, 26, 32, 1)",
"travel010": "rgba(230, 246, 255, 1)",
"travel020": "rgba(173, 228, 255, 1)",
"travel030": "rgba(70, 205, 249, 1)",
"travel040": "rgba(0, 180, 223, 1)",
"travel050": "rgba(0, 155, 192, 1)",
"travel060": "rgba(0, 129, 160, 1)",
"travel070": "rgba(0, 97, 122, 1)",
"travel080": "rgba(0, 69, 87, 1)",
"travel090": "rgba(0, 53, 67, 1)",
"travel100": "rgba(0, 28, 37, 1)",
"tv010": "rgba(251, 240, 252, 1)",
"tv020": "rgba(245, 209, 247, 1)",
"tv030": "rgba(236, 167, 241, 1)",
"tv040": "rgba(229, 128, 235, 1)",
"tv050": "rgba(222, 82, 229, 1)",
"tv060": "rgba(186, 66, 192, 1)",
"tv070": "rgba(142, 48, 146, 1)",
"tv080": "rgba(102, 33, 105, 1)",
"tv090": "rgba(79, 23, 82, 1)",
"tv100": "rgba(45, 10, 47, 1)",
"socialFacebook": "rgba(24, 119, 242, 1)",
"socialInstagram": "rgba(195, 42, 163, 1)",
"socialReddit": "rgba(255, 69, 0, 1)",
"socialTwitter": "rgba(29, 161, 242, 1)",
"socialWhatsapp": "rgba(37, 211, 102, 1)",
"socialYoutube": "rgba(255, 0, 0, 1)",
"sun010": "rgba(255, 240, 240, 1)",
"sun020": "rgba(255, 210, 210, 1)",
"sun030": "rgba(255, 168, 168, 1)",
"sun040": "rgba(255, 127, 128, 1)",
"sun050": "rgba(255, 76, 77, 1)",
"sun060": "rgba(235, 23, 1, 1)",
"sun070": "rgba(179, 18, 1, 1)",
"sun080": "rgba(130, 12, 1, 1)",
"sun090": "rgba(101, 10, 0, 1)",
"sun100": "rgba(57, 5, 0, 1)",
"inkBase": "neutral090",
"inkBrand010": "sun060",
"inkContrast": "neutral100",
"inkHeadingLink": "neutral100",
"inkHeadingLinkActive": "neutral090",
"inkHeadingLinkHover": "neutral090",
"inkHeadingLinkVisited": "neutral100",
"inkInformative": "blue060",
"inkInverse": "white",
"inkLink": "blue060",
"inkLinkActive": "blue080",
"inkLinkHover": "blue070",
"inkLinkVisited": "purple060",
"inkNegative": "red060",
"inkNonEssential": "neutral030",
"inkNotice": "amber060",
"inkPositive": "green060",
"inkSubtle": "neutral060",
"semanticInformative010": "blue060",
"semanticNegative010": "red020",
"semanticNegative020": "red030",
"semanticNegative030": "red060",
"semanticNegative040": "red070",
"semanticNegative050": "red080",
"semanticNotice010": "amber060",
"semanticPositive010": "green010",
"semanticPositive020": "green020",
"semanticPositive030": "green060",
"semanticPositive040": "green070",
"semanticPositive050": "green080",
"interface010": "white",
"interface020": "neutral010",
"interface030": "neutral020",
"interface040": "neutral030",
"interface050": "neutral040",
"interface060": "neutral100",
"interfaceBackground": "white",
"interfaceBrand010": "sun060",
"interfaceBrand020": "sun070",
"Inverse": "white",
"disabled": "neutral010",
"interactive010": "blue020",
"interactive020": "blue030",
"interactive030": "blue060",
"interactive040": "blue070",
"interactive050": "blue080",
"interactive110": "neutral020",
"interactive120": "neutral030",
"interactive130": "neutral080",
"interactive140": "neutral090",
"interactive150": "neutral100",
"interactive210": "neutral030",
"interactive220": "neutral050",
"interactive230": "blue060",
"interactive240": "blue080",
"interactive250": "blue030",
"skeleton010": "neutral010",
"skeleton020": "neutral020",
"transparent": "transparent"
}
function splitWords(s) {
var re, match, output = [];
// re = /[A-Z]?[a-z]+/g
re = /([A-Za-z]?)([a-z]+)/g;
match = re.exec(s);
while (match) {
output.push([match[1].toUpperCase(), match[2]].join(""));
match = re.exec(s);
}
return output;
}
function splitCategoriesJSON(data){
let str = JSON.stringify(data, '\n', 4)
let arr = str.split('\n')
let prevCat = null
arr.forEach((item,index) => {
let cat = splitWords(item)[0]
if(prevCat !== cat && index != 1 && index != arr.length-1){
arr[index-1] += '\n'
}
prevCat = cat
})
str = arr.join('\n')
return str
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment