8000 hexToRgba fails for hex shortcodes · Issue #1 · coreui/coreui-utils · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
hexToRgba fails for hex shortcodes #1
Open
@jameswilson

Description

@jameswilson

Testing the v3-next functionality, the new coreui.Utils.hexToRgba fails on the --info color code, because it is a 3-digit hex value, instead of a standard 6 digit hex value.

<style>
:root {
  --primary: #321fdb;
  --secondary: #ced2d8;
  --success: #2eb85c;
  --info: #39f;
  --warning: #f9b115;
  --danger: #e55353;
  --light: #ebedef;
  --dark: #636f83;
  --breakpoint-xs: 0;
  --breakpoint-sm: 576px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 992px;
  --breakpoint-xl: 1200px;
  --font-family-sans-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  --font-family-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
</style>
<script src="vendors/@coreui/chartjs/js/coreui-chartjs.bundle.js"></script>
<script src="vendors/@coreui/utils/js/coreui-utils.js"></script>
<script>
  console.log(coreui.Utils.getStyle('--info'));
  console.log(coreui.Utils.hexToRgba(coreui.Utils.getStyle('--info'), 90));
  console.log('#3399ff');
  console.log(coreui.Utils.hexToRgba('#3399ff', 90));
</script>

Output in JS console is the following:

#39f
rgba(3, 9, 15, 0.9)
#3399ff
rgba(51, 153, 255, 0.9)

Expected output should be:

#39f
rgba(51, 153, 255, 0.9)
#3399ff
rgba(51, 153, 255, 0.9)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0