wildphp/irc-textformatter

WildPHP 的 IRC 文本格式化工具

v0.1 2019-01-23 17:55 UTC

This package is auto-updated.

Last update: 2024-08-30 01:00:51 UTC


README

Build Status Scrutinizer Code Quality Scrutinizer Code Coverage Latest Stable Version Latest Unstable Version Total Downloads

一个用于按照IRC标准格式化文本的小型库。

安装

要安装此包,您需要 Composer

$ composer require wildphp/irc-textformatter ^0.1

使用方法

格式化器作为一个工具类工作。它暴露以下方法

  • bold(string $text)
  • italic(string $text)
  • underline(string $text)
  • color(string $text, string $foreground, string $background = '') (下面将展示支持的颜色)

除了上述基本方法,还提供了一些更高级的方法

  • findColorByString(string $color) - 根据人类可读的输入返回一个带颜色代码的数字字符串('white' 返回 '00',请参见下方的颜色表)
  • calculateStringColor(string $stringToColor) - 根据字符串内容返回一个带颜色代码的数字字符串
  • consistentStringColor(string $stringToColor) - 与上述相同,但预先将颜色应用于字符串

它还允许您从文本中去除各种格式元素

  • stripBold(string $text)
  • stripItalic(string $text)
  • stripUnderline(string $text)
  • stripColor(string $text)

颜色表

贡献者

您可以在 GitHub 仓库中查看完整的贡献者列表 在这里