Larkinabout / fvtt-token-action-hud-core

Token Action HUD is a repositionable HUD of actions for a selected token.
13 stars 18 forks source link

[FEATURE] apply root style sheet class #105

Closed dmrickey closed 1 year ago

dmrickey commented 1 year ago

If I'm adding colored elements to into my action buttons, I need to know a way to know which base style is applied. For instance, "white" on the default Foundry UI looks fine, but that same "white" won't be nearly as visible on the Pathfinder style.

The style sheets are swapped when the setting changes. But it looks like the only way to for me to choose a correct color would be to check that setting myself and apply a different class based on the setting. However, if there were classes added (e.g. tah-foundry-palette, tah-pathfinder-palette, tah-dorako-palette, etc), then I could set up css variables that are swapped out and it would be much simpler to handle custom colors than doing something programmatically.

That way I could do something like this in my own style sheet.

:root {
  // default color in case there's a new style
  --nulled-out: #cc1133;

  .tah-dorako-palette {
    --nulled-out: #7e0011;
  }
  .tah-foundry-palette {
    --nulled-out: #9e1d3d;
  }
  // etc

  #token-action-hud {
    .action-nulled-out .tah-action-button-content {
      &::before {
        content: "Ø";
        color: var(--nulled-out);
      }
    }
  }
}

That's a style I've got for skills that "can't" be used without skill ranks (but most still have limited use even untrained so they should still be actions), but right now I've got it hardcoded to a specific color that stays the same on core style swaps image

Larkinabout commented 1 year ago

Sounds reasonable. I've done something similar for skills in Pathfinder 2, but managed to color them so they look alright on each style. I can definitely see a desire to match the style.

Larkinabout commented 1 year ago

Added in Token Action HUD Core 1.4.0.