gruntjs / gruntjs/grunt

provide semantic styling functions so colors can be consistent across plugins

Open
#957 3 comments 0 reactions 0 assignees View on GitHub
prolog Type: Enhancement
Dominant language
JavaScript
Stars
12.2k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

We save time and headaches with semantic CSS, lets take those concepts to Grunt.

**Problem**

You are creating a Grunt plugin that needs print a `url` to the console. What color should it be? You could pick something that happens to look nice in _your_ terminal but it won't necessarily look nice for everybody else and won't necessarily be consistent with other plugins that print urls.

**Solution**

Use a semantic styling function. For example: `grunt.style.url(url)`. By default this might style the url to be `blue.underline`, but that can be easily changed across all Grunt tasks. Maybe blue doesn't show up on some terminals well so those users prefer `black.yellowBG`.

This should also be used internally by Grunt for things like `grunt.log.heading`, warning and error messages, file names, etc.

It should possible to extend the list of semantic styles so that developers can create styles for things that `Grunt` may not need to provide by default.

It should be easy for people to publish and use alternate color patterns, such as color that look good for terminals with white backgrounds.

_Q: Why not just do this as a 3rd party module?_
_A: Adoption. This is more likely to be used if it was part of Grunt._

_Concept from my co-worker @nickheiner._

Contributor guide

Open the contributing guide

Research direction

Start by reading Grunt's existing console logging and styling APIs, including grunt.log.heading and the proposed grunt.style.url entry point. Define the semantic styles needed for URLs, headings, warnings, errors, and file names, along with how plugins can extend or replace them. Done means Grunt and plugins can use consistent semantic styles and users can choose alternate color patterns.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.