Skip to content

Reference native Grafana css classes? #156

Answered by ZuperZee
astro-manny asked this question in Q&A
Discussion options

You must be logged in to vote

You can add all the styleSheets to the htmlNode

onInit

for (const sheet of document.styleSheets) {
  const constructedSheet = new CSSStyleSheet()
  for (const rule of sheet.cssRules) {
    constructedSheet.insertRule(rule.cssText);
  }
  htmlNode.adoptedStyleSheets.push(constructedSheet)
}

Example dashboard

{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@astro-manny
Comment options

Answer selected by astro-manny
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants