Skip to content

Commit

Permalink
Merge pull request #996 from rsteube/style-forextension
Browse files Browse the repository at this point in the history
style: added ForExtension
  • Loading branch information
rsteube committed Feb 26, 2024
2 parents 1a41eb8 + bb21bdb commit 7d529b7
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 7d529b7

Please sign in to comment.