Skip to content

Commit

Permalink
style: added ForExtension
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Feb 26, 2024
1 parent 1a41eb8 commit bb21bdb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/style/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ func ForPathExt(path string, sc Context) string {
return fromSGR(lscolors.GetColorist(sc.Getenv("LS_COLORS")).GetStyleExt(path))
}

// ForExtension returns the style for given extension
//
// json
func ForExtension(path string, sc Context) string {
return ForPathExt("."+path, sc)
}

func fromSGR(sgr string) string {
s := ui.StyleFromSGR(sgr)
result := []string{}
Expand Down

0 comments on commit bb21bdb

Please sign in to comment.