Skip to content

Commit

Permalink
feat(comp:icon): support fill currentColo (#57)
Browse files Browse the repository at this point in the history
fix #56
  • Loading branch information
danranVm authored Dec 22, 2020
1 parent 0d60496 commit 8326e40
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
9 changes: 7 additions & 2 deletions packages/components/icon/demo/Basic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<ix-icon name="up" />
<ix-icon name="down" rotate />
<ix-icon name="left" rotate="90" />
<ix-icon name="right" rotate />
<ix-icon name="ix-icon-up" iconfont />
<ix-icon name="right" style="color: red" rotate />
<ix-icon name="ix-icon-up" class="icon-blue" iconfont />
<ix-icon name="ix-icon-down" iconfont />
</template>

Expand All @@ -29,3 +29,8 @@ export default defineComponent({
},
})
</script>
<style lang="less" scoped>
.icon-blue {
color: blue;
}
</style>
1 change: 1 addition & 0 deletions packages/components/icon/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ function setSVGAttribute(svg: SVGElement, iconName: string): void {
svg.setAttribute('width', '1em')
svg.setAttribute('height', '1em')
svg.setAttribute('focusable', 'false')
svg.setAttribute('fill', 'currentColor')
svg.setAttribute('aria-hidden', 'true')
svg.setAttribute('data-icon', iconName)
}
Expand Down
3 changes: 2 additions & 1 deletion packages/components/icon/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
@icon-prefix: ~'@{idux-prefix}-icon';

.@{icon-prefix} {
color: #fff;
display: inline-block;
color: inherit;
}

0 comments on commit 8326e40

Please sign in to comment.