Metadata-Version: 2.4
Name: Luci-Code-Tools
Version: 2.1.3
Summary: 安全输入工具库,支持彩色输出,KeyboardInterrupt保护等
Home-page: https://github.com/Luci-Codeing/code_tools
Author: Luci_Code
Author-email: 3967742419@qq.com
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENCE
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python
Dynamic: summary

[![PyPI version](https://badge.fury.io/py/luci-code-tools.svg)](https://pypi.org/project/Luci_Code_Tools/)

[![Python Version](https://img.shields.io/badge/Python-3.6+-blue.svg)]()

[![License](https://img.shields.io/badge/License-MIT-green.svg)]()

[![Cat](https://img.shields.io/badge/Cat-Approved-orange.svg)]()

---

**English document is located at the very bottom**

**This English document was translated using Google Translate and may contain inaccuracies**

---

# 感谢

**你点开了这个 *README.md***

**非常感谢你点进来喵🐱**

**我叫 Luci_Code**

**是一名 2014 年出生的开发者**

**2025 年 11 月开始学习编程**

---

# 现在开始功能介绍喵🐱

## ✨ 特性

- 🎨 **ANSI 真彩色** + RGB 支持, 想要什么颜色就什么颜色
- 🛡️ **20+ 异常处理**
- 🌐 **中英双语**, 谁都能看懂错误信息
- 🐧 **跨平台**, 支持: Windows / macOS / Linux / Android
- 📝 **注释比代码还多**, 不怕看不懂
- 😼 **由一位 2014 出生年的作者维护**, 从 2025 年 11 月开始学

## ⚙ 函数

- color
- color_rgb
- clear_screen
- safe_input
- safe_int
- safe_float

## 🎞 安装 & 使用

**安装**

```bash
pip install Luci-Code-Tools
```

**使用**

- 方式 1 - import

```python
import Luci_code_tools
Luci_code_tools.color("字符输出", 32, None, 1)
```

- 方式 1 - 附加 as

```python
import Luci_code_tools as lct
lct.color("字符输出", 32, None, 1)
```

- 方式 2 - from

```python
from Luci_code_tools import color
color("字符输出", 32, None, 1)
```

- 方式 2 - from - 附加 as

```python
from Luci_code_tools import color as cl
cl("字符输出", 32, None, 1)
```

## 📃 许可证

MIT Licence (c) Luci_Code

---

# 🛠 函数

| 函数名 | 功能 | 参数列表 |
| --- | --- | --- |
| color_rgb | 输出真彩色文本, 支持 rgb 调色 | data, r, g, b, newline |
| color | 输出 ANSI 转义序列固定颜色, 适合不会调色的开发者 | data, text_color, bg_color, mode, newline |
| clear_screen | 在任意系统下都能清屏的函数 | 无参数 |
| safe_input | 让用户安全的输入字符串 | prompt, text_color, bg_color, mode |
| safe_int | 让用户安全的输入整数 | prompt, text_color, bg_color, mode |
| safe_float | 让用户安全的输入浮点数 | prompt, text_color, bg_color, mode |

---

# 参数使用教程

**newline** 是指在原本的基础上再输出一行, 默认为 True (多一行)

***输出效果:***

- newline=True :

content-1 (此处为 False)
content-2

input: content

if-content-prompt

- newline=False :

content-1
content-2
input: content
if-content-prompt

**这一改动让命令行的输出变得有辨识度, 高级**

**data, prompt** 都是 *输出的文本* 的意思

---

- **color_rgb**

**color_rgb** 的参数有: data, r, g, b, newline

**其中**, data 是数据的意思, 代表输出的内容, [r, g, b] 是 ***标准 rgb 调色*** 的用处, 所以 [r, g, b] 分别填入 r, g, b 的值, newline 不用讲解, 前面说了喵

- **color**

**color** 的参数有: data, text_color, bg_color, mode, newline

**data** 和之前一样, ***[text_color, bg_color, mode]***, 这三个参数在 safe_\* 中也有, 意思相同, 暂不讲解, **text_color** 就是控制输出的文本的颜色**(前景色)**, bg_color** 是输出文本的**背景色**, **mode** 为输出的格式 **(显示方式)**, 这三个参数在最后会有**表格对照表**

- **clear_screen**

**clear_screen** 没有任何参数, 使用就清屏, 无论在 **Linux, MacOS, Windows, Android** 上都能运行, 我们还贴心的为 **REPL / 交互式环境和脚本** 和 **非交互式环境** 准备了不同的方案, 确保他们都能运行喵

- **safe_input**

**safe_input** 的参数有 ***[prompt, text_color, bg_color, mode]***

这些似乎都不用讲解了, 毕竟参数全都讲解过了, [prompt] 在 (# 参数使用教程) 的下方, **text_color**, **bg_color, mode** 在 **color** 函数中讲解了

- **safe_int** / **safe_float**

这两个函数和 **safe_input** 的函数讲解基本相同, 我就不重复了喵

**safe_int**, **safe_float** 分别是 **安全输入整数**, **安全输入浮点数**

---

# 参数对照表

## 前景色

| 前景色 - 值 | 效果 |
| --- | --- |
| 30 | 黑色 |
| 31 | 红色 |
| 32 | 绿色 |
| 33 | 黄色 |
| 34 | 蓝色 |
| 35 | 紫色 |
| 36 | 青色 |
| 37 | 白色 |

## 前景色 - 浅色

| 前景色 - 值 | 效果 |
| --- | --- |
| 90 | 深灰色 |
| 91 | 浅红色 |
| 92 | 浅绿色 |
| 93 | 浅黄色 |
| 94 | 浅蓝色 |
| 95 | 浅紫色 |
| 96 | 浅青色 |
| 97 | 浅灰色 |

## 背景色

| 背景色 - 值 | 效果 |
| --- | --- |
| 40 | 黑色 |
| 41 | 红色 |
| 42 | 绿色 |
| 43 | 黄色 |
| 44 | 蓝色 |
| 45 | 紫色 |
| 46 | 青色 |
| 47 | 白色 |

## 背景色 - 浅色

| 背景色 - 值 | 效果 |
| --- | --- |
| 100 | 深灰色 |
| 101 | 浅红色 |
| 102 | 浅绿色 |
| 103 | 浅黄色 |
| 104 | 浅蓝色 |
| 105 | 浅紫色 |
| 106 | 浅青色 |
| 107 | 纯白色 |

## 显示方式

| 显示方式 - 值 | 效果 |
| --- | --- |
| 0 | 默认 |
| 1 | 高亮 + 加粗 |
| 2 | 暗淡 |
| 3 | 斜体 (部分终端可能不支持) |
| 4 | 下划线 |
| 5 | 闪烁 |
| 6 | 快闪(部分终端可能不支持) |
| 7 | 反色(前景色与背景色互换) |
| 8 | 隐藏 |
| 9 | 删除线 |

---

# 制作者 & 感谢名单

| 制作 | 分工 |
| --- | --- |
| DeepSeek | 检查 |
| DeepSeek | 改进方法 |
| Luci_Code | 改进 |
| Luci_Code | 思路 |
| Luci_Code | 文档 |
| Luci_Code | 上传 |
| Luci_Code | 制作初版 |

---

# 感谢

**< 感谢你看到这里 >**

**一位 2014 年出生的开发者**

---

# English document

[![PyPI version](https://badge.fury.io/py/luci-code-tools.svg)](https://pypi.org/project/luci-code-tools/)

[![Python Version](https://img.shields.io/badge/Python-3.6+-blue.svg)]()

[![License](https://img.shields.io/badge/License-MIT-green.svg)]()

[![Cat](https://img.shields.io/badge/Cat-Approved-orange.svg)]()

---

# Thank You

**for clicking on this README.md**

**Thank you so much for stopping by! 🐱**

**My name is Luci_Code**

**I am a developer born in 2014**

**I started learning to program in November 2025**

---

# Now, let's introduce the features! 🐱

## ✨ Features

- 🎨 **ANSI True Color** + RGB support—pick any color you desire!
- 🛡️ **20+ Exception Handlers**
- 🌐 **Bilingual Support (Chinese/English)**—everyone can understand the error messages
- 🐧 **Cross-Platform**—supports: Windows / macOS / Linux / Android
- 📝 **More Comments Than Code**—no need to worry about not understanding it
- 😼 **Maintained by an Author Born in 2014**—who started learning in November 2025

## ⚙ Functions

- color
- color_rgb
- clear_screen
- safe_input
- safe_int
- safe_float

## 🎞 Installation & Usage

**Installation**

```bash
pip install Luci-Code-Tools
```

**Usage**

- Method 1 - `import`

```python
import Luci_code_tools
Luci_code_tools.color("Text Output", 32, None, 1)
```

- Method 1 - `import ... as ...`

```python
import Luci_code_tools as lct
lct.color("Text Output", 32, None, 1)
```

- Method 2 - `from ... import ...`

```python
from Luci_code_tools import color
color("Character Output", 32, None, 1)
```

- Method 2 - `from` - with `as` alias

```python
from Luci_code_tools import color as cl
cl("Character Output", 32, None, 1)
```

## 📃 License

MIT License (c) Luci_Code

---

# 🛠 Functions

| Function Name | Functionality | Parameter List |
| --- | --- | --- |
| color_rgb | Outputs true-color text; supports RGB color customization. | data, r, g, b, newline |
| color | Outputs text using fixed ANSI escape sequence colors; suitable for developers unfamiliar with color mixing. | data, text_color, bg_color, mode, newline |
| clear_screen | A function that clears the screen on any operating system. | No parameters |
| safe_input | Safely prompts the user to input a string. | prompt, text_color, bg_color, mode |
| safe_int | Safely prompts the user to input an integer. | prompt, text_color, bg_color, mode |
| safe_float | Safely prompts the user to input a floating-point number. | prompt, text_color, bg_color, mode |

---

# Parameter Usage Guide

**newline** refers to whether an additional line break is added after the output; it defaults to `True` (adding an extra line).

***Output Effect:***

- `newline=True`:

content-1 (Here, this implies `False`)
content-2

input: content

if-content-prompt

- `newline=False`:

content-1
content-2
input: content
if-content-prompt

**This modification makes the command-line output more visually distinct and sophisticated.**

**data** and **prompt** both refer to the *text being output*.

---

- ​​**color_rgb**

The parameters for **color_rgb** are: data, r, g, b, newline.

**Specifically:** `data` refers to the actual content being output; `[r, g, b]` are used for ***standard RGB color mixing***—simply fill in the respective values ​​for r, g, and b. The `newline` parameter requires no further explanation, as it was covered earlier!

- **color**

The parameters for **color** are: `data`, `text_color`, `bg_color`, `mode`, and `newline`.

**data**: As before, this takes the format `[text_color, bg_color, mode]`. These three parameters also appear in the `safe_*` functions with the same meanings, so we won't explain them again here. **text_color** controls the color of the output text (the **foreground color**); **bg_color** controls the **background color** of the output text; and **mode** specifies the output format (the **display style**). A **reference table** for these three parameters can be found at the end of this document.

- **clear_screen**

**clear_screen** takes no arguments; simply calling it clears the screen. It works across **Linux, MacOS, Windows, and Android**. We have also thoughtfully implemented different solutions for **REPL/interactive environments (and scripts)** versus **non-interactive environments** to ensure it functions correctly in all scenarios.

- **safe_input**

The parameters for **safe_input** are: `[prompt, text_color, bg_color, mode]`.

These likely require no further explanation, as all the parameters have already been covered. The `[prompt]` parameter is discussed below in the (# Parameter Usage Tutorial) section, while **text_color**, **bg_color**, and **mode** were explained in the **color** function section.

- **safe_int** / **safe_float**

The explanations for these two functions are essentially identical to that of **safe_input**, so I won't repeat myself here.

**safe_int** and **safe_float** are used for **safely inputting integers** and **safely inputting floating-point numbers**, respectively.

---

# Parameter Reference Table

## Foreground Colors

| Foreground Value | Effect |
| --- | --- |
| 30 | Black |
| 31 | Red |
| 32 | Green |
| 33 | Yellow |
| 34 | Blue |
| 35 | Purple |
| 36 | Cyan |
| 37 | White |

## Foreground Colors - Light Tones

| Foreground Value | Effect |
| --- | --- |
| 90 | Dark Gray |
| 91 | Light Red |
| 92 | Light Green |
| 93 | Light Yellow |
| 94 | Light Blue |
| 95 | Light Purple |
| 96 | Light Cyan |
| 97 | Light Gray |

## Background Colors

| Background Color - Value | Effect |
| --- | --- |
| 40 | Black |
| 41 | Red |
| 42 | Green |
| 43 | Yellow |
| 44 | Blue |
| 45 | Purple |
| 46 | Cyan |
| 47 | White |

## Background Colors - Light Tones

| Background Color - Value | Effect |
| --- | --- |
| 100 | Dark Gray |
| 101 | Light Red |
| 102 | Light Green |
| 103 | Light Yellow |
| 104 | Light Blue |
| 105 | Light Purple |
| 106 | Light Cyan |
| 107 | Pure White |

## Display Modes

| Display Mode - Value | Effect |
| --- | --- |
| 0 | Default |
| 1 | Highlight + Bold |
| 2 | Dim |
| 3 | Italic (May not be supported by some terminals) |
| 4 | Underline |
| 5 | Blink |
| 6 | Rapid Blink (May not be supported by some terminals) |
| 7 | Reverse (Foreground and background colors swapped) |
| 8 | Hidden |
| 9 | Strikethrough |

---

# Credits & Acknowledgments

| Contributor | Role |
| --- | --- |
| DeepSeek | Review |
| DeepSeek | Method Improvement |
| Luci_Code | Improvements |
| Luci_Code | Conceptualization |
| Luci_Code | Documentation |
| Luci_Code | Upload |
| Luci_Code | First Edition |

---

# Acknowledgments

**< Thank you for reading this far >**

**A developer born in 2014**
