UNPKG

@mibuilder/colors

Version:

Standard colors for MiBuilder CLI

127 lines (94 loc) 4.59 kB
# @mibuilder/colors > Standard colors for [MiBuilder][] CLI [![Commitizen friendly][commitizen-badge]][commitizen] [![Conventional Commits][conventional-commits-badge]][conventional-commits] [![Semantic Release][semantic-release-badge]][semantic-release] [![Code of Conduct][coc-badge]][coc] [![MIT License][license-badge]][license] [![npm latest version][latest-version-badge]][package] [![npm next version][next-version-badge]][package] ## This Solution Standard colors for [MiBuilder][] CLI. Using color is encouraged in commands to help the user quickly read command output. Some nouns in the CLI such as apps and config vars have standard colors that should be used when possible. ## Table of Contents <!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> - [Installation](#markdown-header-installation) - [Usage](#markdown-header-usage) - [References](#markdown-header-references) - [Other Use Cases](#markdown-header-other-use-cases) - [Acknowledgements](#markdown-header-acknowledgements) - [License](#markdown-header-license) <!-- END doctoc generated TOC please keep comment here to allow auto update --> ## Installation This module can be installed via [npm][npm-cli] which is bundled with [Node.js][node] and should be installed as one of your project's [dependencies][]: ```bash npm install --save @mibuilder/colors ``` ## Usage ```javascript import { color } from '@mibuilder/colors'; this.log(`this is an app: ${color.app(myapp.name)}`); this.log(`this is a config var: ${color.configVar(myapp.name)}`); ``` When a standard color isn’t available, color can be used to show other colors as well: ```javascript import { color } from '@mibuilder/colors'; this.log(`this is an other color: ${color.green(result.message)}`); ``` Suggested colors are magenta, cyan, blue, green, and gray. Don’t forget that `.dim` and `.bright`, `.underline`, and background colors can also be used to provide more variety in color use. Be mindful with color. Too many contrasting colors in the same place can quickly begin to compete for the user’s attention. Using just a couple of colors and maybe dim/bolding existing ones can often provide enough contrast. Yellow and red may also be used, but note that these typically are saved for errors and warning messages. ## References - [@mibuilder/command][mibuilder-command] - Contains base MiBuilder CLI command, `MiBuilderCommand`. ## Other Use Cases If you lack some use cases, you are welcome to open a pull request and add it. We'll come back to you and see how we can support your use case and present it to all devs. Please consult the [contribution guides][contributing] before contributing. ## Acknowledgements This library is heavily inspired by [@heroku-cli/color][heroku-cli-color]. Thank you 💙 ## License [MIT][license] Copyright © 2020-present [die.interaktiven GmbH & Co. KG][dia-website] [coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg [coc]: ./other/CODE_OF_CONDUCT.md [commitizen]: http://commitizen.github.io/cz-cli [commitizen-badge]: https://img.shields.io/badge/commitizen-friendly-brightgreen.svg [contributing]: ./CONTRIBUTING.md [conventional-commits]: https://conventionalcommits.org [conventional-commits-badge]: https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg [dependencies]: https://docs.npmjs.com/specifying-dependencies-and-devdependencies-in-a-package-json-file [dia-website]: https://die-interaktiven.de [downloads-badge]: https://img.shields.io/npm/dw/@mibuilder/colors.svg [downloads-total-badge]: https://img.shields.io/npm/dt/@mibuilder/colors.svg [heroku-cli-color]: https://github.com/heroku/heroku-cli-color [latest-version-badge]: https://img.shields.io/npm/v/@mibuilder/colors/latest.svg [license]: https://opensource.org/licenses/MIT [license-badge]: https://img.shields.io/npm/l/@mibuilder/core.svg [mibuilder]: https://npmjs.com/package/@mibuilder/cli [mibuilder-command]: https://npmjs.com/package/@mibuilder/command [next-version-badge]: https://img.shields.io/npm/v/@mibuilder/colors/next.svg [package]: https://npmjs.com/package/@mibuilder/colors [node]: https://nodejs.org [npm]: https://www.npmjs.com [npm-cli]: https://www.npmjs.com/package/npm [semantic-release]: https://github.com/semantic-release/semantic-release [semantic-release-badge]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg [version-badge]: https://img.shields.io/npm/v/@mibuilder/colors.svg