How to use the ink.Color function in ink

To help you get started, we’ve selected a few ink examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github burgerbuds / swiff / dist / Swiff.js View on Github external
hex: disabledColor || normalColor
        }, `${isActive ? '⌛  ' : emoji ? `${emoji}  ` : ''}${title}`), _react.default.createElement(_ink.Color, {
          bold: false,
          hex: _palette.hexMuted,
          dim: isDisabled(config, id)
        }, description ? `: ${description}` : ''));
      },
      // Remove the indicator
      indicatorComponent: _ => ''
    };
    const showOptions = !isFlaggedStart && !removeOptions;
    return _react.default.createElement(_ink.Box, {
      flexDirection: "column"
    }, showOptions ? _react.default.createElement(_ink.Box, {
      marginBottom: 1
    }, _react.default.createElement(_ink.Color, {
      dim: isTaskRunning(messages)
    }, _react.default.createElement(_templates.OptionsTemplate, {
      selectProps: OptionsSelectProps
    }))) : null, !(0, _utils.isEmpty)(messages) && _react.default.createElement(_templates.MessageTemplate, {
      messages: messages,
      isFlaggedStart: isFlaggedStart
    }));
  }
github burgerbuds / swiff / dist / Swiff.js View on Github external
itemComponent: ({
        emoji,
        id,
        title,
        description,
        isSelected
      }) => {
        const isActive = currentTask && currentTask.title === title && isTaskRunning(messages);
        const disabledColor = isDisabled(config, id) && (isSelected ? '#CCC' : _palette.hexMuted);
        const normalColor = !isDisabled(config, id) && (isSelected ? _palette.hexHighlight : _palette.hexDefault);
        return _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(_ink.Color, {
          bold: true,
          dim: isDisabled(config, id),
          hex: disabledColor || normalColor
        }, `${isActive ? '⌛  ' : emoji ? `${emoji}  ` : ''}${title}`), _react.default.createElement(_ink.Color, {
          bold: false,
          hex: _palette.hexMuted,
          dim: isDisabled(config, id)
        }, description ? `: ${description}` : ''));
      },
      // Remove the indicator
github MihaiVoinea / makerlog-cli / build / commands / done.js View on Github external
if (!content) return this.setState({
      message: "You must add something to log."
    });

    try {
      const res = await (0, _phin.default)({
        url: "https://api.getmakerlog.com/tasks/",
        method: "POST",
        data: {
          content,
          done: true
        }
      });

      if (res.statusCode === 200 || res.statusCode === 201) {
        const message = _react.default.createElement(_react.Fragment, null, _react.default.createElement(_ink.Color, {
          bgHex: "#009056"
        }, " DONE "), " " + res.body.content);

        return this.setState({
          message: message
        });
      }
    } catch (e) {
      console.log(e);
    }
  }
github MihaiVoinea / makerlog-cli / build / commands / todo.js View on Github external
module.exports = () => _react.default.createElement(_react.Fragment, null, _react.default.createElement(_ink.Color, {
  green: true
}, _react.default.createElement(_inkSpinner.default, {
  type: "dots"
})), " Loading");
},{}],"todo.js":[function(require,module,exports) {
github Dolov / git-commit-cp / dist / Components / Input.js View on Github external
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }

function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }

function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }

function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

var React = require('react');

var _require = require('ink'),
    Color = _require.Color,
    Box = _require.Box;

var TextInput = require('ink-text-input')["default"];

var _require2 = require("../utils"),
    getDesc = _require2.getDesc;

var Required = require('import-jsx')("./Required");

var Input =
/*#__PURE__*/
function (_React$Component) {
  _inherits(Input, _React$Component);

  function Input() {
    var _this;
github Dolov / git-commit-cp / dist / index.js View on Github external
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _nonIterableRest(); }

function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }

function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }

function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

var React = require('react');

var _require = require('ink'),
    render = _require.render,
    Color = _require.Color,
    Box = _require.Box;

var Welcome = require('import-jsx')("./Components/Welcome");

var Rules = require('import-jsx')("./Components/Rules");

var utils = require("./utils");

var commit = utils.commit,
    getConfig = utils.getConfig,
    isValidCommit = utils.isValidCommit;

var _getConfig = getConfig(),
    title = _getConfig.title,
    rules = _getConfig.rules;
github MihaiVoinea / makerlog-cli / build / commands / login.js View on Github external
module.exports = () => _react.default.createElement(_react.Fragment, null, _react.default.createElement(_ink.Color, {
  green: true
}, _react.default.createElement(_inkSpinner.default, {
  type: "dots"
})), " Loading");
},{}],"login.js":[function(require,module,exports) {
github burgerbuds / swiff / dist / templates.js View on Github external
}, !(0, _utils.isEmpty)(messages) && messages.map(({
  text,
  type
}, i) => _react.default.createElement(_ink.Box, {
  key: `msg${i}`
}, type === 'heading' && !isFlaggedStart && _react.default.createElement(_ink.Box, {
  marginBottom: 1
}, _react.default.createElement(_ink.Text, {
  bold: true
}, `—— ${text} ——`)), type === 'heading' && isFlaggedStart && _react.default.createElement(_ink.Text, {
  bold: true
}, `${text}\n`), _react.default.createElement(_ink.Color, {
  dim: messages.length - 1 !== i
}, type === 'error' && `💩  ${text}`, type === 'success' && `👌  ${text}`, type === 'message' && `💁‍  ${text}`, type === 'working' && (messages.length - 1 === i ? _react.default.createElement(_inkSpinner.default, {
  type: "runner"
}) : `🏃 `), type === 'working' && ` ${text}`))));

ink

React for CLI

MIT
Latest version published 5 months ago

Package Health Score

93 / 100
Full package analysis