8000 hexToRgba fails for hex shortcodes · Issue #1 · coreui/coreui-utils · GitHub
[go: up one dir, main page]

Skip to content

hexToRgba fails for hex shortcodes #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jameswilson opened this issue Feb 6, 2020 · 1 comment
Open

hexToRgba fails for hex shortcodes #1

jameswilson opened this issue Feb 6, 2020 · 1 comment

Comments

@jameswilson
Copy link

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)
jameswilson added a commit to jameswilson/coreui-utils that referenced this issue Feb 6, 2020
@jameswilson
Copy link
Author

See PR #3

jameswilson added a commit to jameswilson/coreui-utils that referenced this issue Feb 6, 2020
jameswilson added a commit to jameswilson/coreui-utils that referenced this issue Feb 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0