Facundo Sanchez
11/28/2022, 7:58 PMDavid B
11/28/2022, 8:23 PMhead
will contain the /core/styles/pagestyles.nl
stylesheet.
The color theme colors will be in the href, for instance here's the values for "Basic : Orange"David B
11/28/2022, 8:25 PMbgoff
(in this case #E5772A)michoel
11/28/2022, 10:07 PM/**
* Attempt to figure out user's selected theme colour
*
* @returns {string} NetSuite theme colour as hex string
*/
function getNetSuiteThemeColour() {
const defaultColour = "#607799";
const $nsNavigation = document.getElementById("ns_navigation");
if ($nsNavigation) {
return window.getComputedStyle($nsNavigation)["background-color"];
}
return defaultColour;
}
David B
11/28/2022, 11:08 PMFacundo Sanchez
11/29/2022, 8:32 PMconst getNetSuiteThemeColour = () => {
const defaultColour = "#607799";
const $nsNavigation = document.getElementById("ns_navigation");
if ($nsNavigation) {
const rgb = window.getComputedStyle($nsNavigation)["background-color"].toString(16);
var rgbArray = rgb.replace('rgb(', '').replace(')', '');
rgbArray = rgbArray.split(', ');
return rgbToHex(rgbArray);
}
return defaultColour;
}
David B
11/29/2022, 8:47 PMconst rgb = window.getComputedStyle($nsNavigation)["background-color"];
return '#'+rgb.match(/\d+/g).map(x=>(+x).toString(16).padStart(2,0)).join('')
David B
11/29/2022, 8:48 PM