Luci-Code-Tools 2.1.3__tar.gz → 2.1.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of Luci-Code-Tools might be problematic. Click here for more details.
- {luci_code_tools-2.1.3 → luci_code_tools-2.1.5}/Luci_Code_Tools.egg-info/PKG-INFO +34 -29
- {luci_code_tools-2.1.3 → luci_code_tools-2.1.5}/Luci_code_tools.py +245 -249
- {luci_code_tools-2.1.3 → luci_code_tools-2.1.5}/PKG-INFO +34 -29
- {luci_code_tools-2.1.3 → luci_code_tools-2.1.5}/README.md +31 -26
- {luci_code_tools-2.1.3 → luci_code_tools-2.1.5}/setup.py +4 -4
- {luci_code_tools-2.1.3 → luci_code_tools-2.1.5}/LICENCE +0 -0
- {luci_code_tools-2.1.3 → luci_code_tools-2.1.5}/Luci_Code_Tools.egg-info/SOURCES.txt +0 -0
- {luci_code_tools-2.1.3 → luci_code_tools-2.1.5}/Luci_Code_Tools.egg-info/dependency_links.txt +0 -0
- {luci_code_tools-2.1.3 → luci_code_tools-2.1.5}/Luci_Code_Tools.egg-info/top_level.txt +0 -0
- {luci_code_tools-2.1.3 → luci_code_tools-2.1.5}/setup.cfg +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: Luci-Code-Tools
|
|
3
|
-
Version: 2.1.
|
|
4
|
-
Summary:
|
|
5
|
-
Home-page: https://github.com/Luci-
|
|
3
|
+
Version: 2.1.5
|
|
4
|
+
Summary: 一个简单的工具库 / A Eazy Tools Module
|
|
5
|
+
Home-page: https://github.com/Luci-Code-2014
|
|
6
6
|
Author: Luci_Code
|
|
7
7
|
Author-email: 3967742419@qq.com
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -20,7 +20,7 @@ Dynamic: license-file
|
|
|
20
20
|
Dynamic: requires-python
|
|
21
21
|
Dynamic: summary
|
|
22
22
|
|
|
23
|
-
[](https://pypi.org/project/Luci_Code_Tools/)
|
|
24
24
|
|
|
25
25
|
[]()
|
|
26
26
|
|
|
@@ -118,8 +118,8 @@ MIT Licence (c) Luci_Code
|
|
|
118
118
|
|
|
119
119
|
| 函数名 | 功能 | 参数列表 |
|
|
120
120
|
| --- | --- | --- |
|
|
121
|
-
| color_rgb | 输出真彩色文本, 支持 rgb 调色 | data, r, g, b,
|
|
122
|
-
| color | 输出 ANSI 转义序列固定颜色, 适合不会调色的开发者 | data, text_color, bg_color, mode,
|
|
121
|
+
| color_rgb | 输出真彩色文本, 支持 rgb 调色 | data, r, g, b, line |
|
|
122
|
+
| color | 输出 ANSI 转义序列固定颜色, 适合不会调色的开发者 | data, text_color, bg_color, mode, line |
|
|
123
123
|
| clear_screen | 在任意系统下都能清屏的函数 | 无参数 |
|
|
124
124
|
| safe_input | 让用户安全的输入字符串 | prompt, text_color, bg_color, mode |
|
|
125
125
|
| safe_int | 让用户安全的输入整数 | prompt, text_color, bg_color, mode |
|
|
@@ -129,27 +129,32 @@ MIT Licence (c) Luci_Code
|
|
|
129
129
|
|
|
130
130
|
# 参数使用教程
|
|
131
131
|
|
|
132
|
-
**
|
|
132
|
+
**line** 是指在原本的基础上再输出 ** {num} ** 行, 默认为 2 (多一行)
|
|
133
133
|
|
|
134
134
|
***输出效果:***
|
|
135
135
|
|
|
136
|
-
|
|
136
|
+
line = 1 : [
|
|
137
|
+
content1
|
|
138
|
+
content2
|
|
139
|
+
input: Luci
|
|
140
|
+
]
|
|
137
141
|
|
|
138
|
-
|
|
139
|
-
|
|
142
|
+
line = 2 : [
|
|
143
|
+
content1 (line = 1)
|
|
144
|
+
content2
|
|
140
145
|
|
|
141
|
-
input:
|
|
146
|
+
input: Luci
|
|
147
|
+
]
|
|
142
148
|
|
|
143
|
-
|
|
149
|
+
line = 3 : [
|
|
150
|
+
content1 (line = 1)
|
|
151
|
+
content2
|
|
144
152
|
|
|
145
|
-
- newline=False :
|
|
146
153
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
input: content
|
|
150
|
-
if-content-prompt
|
|
154
|
+
input: Luci
|
|
155
|
+
]
|
|
151
156
|
|
|
152
|
-
|
|
157
|
+
**这一改动让命令行的输出变得有辨识度**
|
|
153
158
|
|
|
154
159
|
**data, prompt** 都是 *输出的文本* 的意思
|
|
155
160
|
|
|
@@ -157,13 +162,13 @@ if-content-prompt
|
|
|
157
162
|
|
|
158
163
|
- **color_rgb**
|
|
159
164
|
|
|
160
|
-
**color_rgb** 的参数有: data, r, g, b,
|
|
165
|
+
**color_rgb** 的参数有: data, r, g, b, line
|
|
161
166
|
|
|
162
|
-
**其中**, data 是数据的意思, 代表输出的内容, [r, g, b] 是 ***标准 rgb 调色*** 的用处, 所以 [r, g, b] 分别填入 r, g, b 的值,
|
|
167
|
+
**其中**, data 是数据的意思, 代表输出的内容, [r, g, b] 是 ***标准 rgb 调色*** 的用处, 所以 [r, g, b] 分别填入 r, g, b 的值, line 不用讲解, 前面说了喵
|
|
163
168
|
|
|
164
169
|
- **color**
|
|
165
170
|
|
|
166
|
-
**color** 的参数有: data, text_color, bg_color, mode,
|
|
171
|
+
**color** 的参数有: data, text_color, bg_color, mode, line
|
|
167
172
|
|
|
168
173
|
**data** 和之前一样, ***[text_color, bg_color, mode]***, 这三个参数在 safe_\* 中也有, 意思相同, 暂不讲解, **text_color** 就是控制输出的文本的颜色**(前景色)**, bg_color** 是输出文本的**背景色**, **mode** 为输出的格式 **(显示方式)**, 这三个参数在最后会有**表格对照表**
|
|
169
174
|
|
|
@@ -372,8 +377,8 @@ MIT License (c) Luci_Code
|
|
|
372
377
|
|
|
373
378
|
| Function Name | Functionality | Parameter List |
|
|
374
379
|
| --- | --- | --- |
|
|
375
|
-
| color_rgb | Outputs true-color text; supports RGB color customization. | data, r, g, b,
|
|
376
|
-
| color | Outputs text using fixed ANSI escape sequence colors; suitable for developers unfamiliar with color mixing. | data, text_color, bg_color, mode,
|
|
380
|
+
| color_rgb | Outputs true-color text; supports RGB color customization. | data, r, g, b, line |
|
|
381
|
+
| color | Outputs text using fixed ANSI escape sequence colors; suitable for developers unfamiliar with color mixing. | data, text_color, bg_color, mode, line |
|
|
377
382
|
| clear_screen | A function that clears the screen on any operating system. | No parameters |
|
|
378
383
|
| safe_input | Safely prompts the user to input a string. | prompt, text_color, bg_color, mode |
|
|
379
384
|
| safe_int | Safely prompts the user to input an integer. | prompt, text_color, bg_color, mode |
|
|
@@ -383,11 +388,11 @@ MIT License (c) Luci_Code
|
|
|
383
388
|
|
|
384
389
|
# Parameter Usage Guide
|
|
385
390
|
|
|
386
|
-
**
|
|
391
|
+
**line** refers to whether an additional line break is added after the output; it defaults to `True` (adding an extra line).
|
|
387
392
|
|
|
388
393
|
***Output Effect:***
|
|
389
394
|
|
|
390
|
-
- `
|
|
395
|
+
- `line=True`:
|
|
391
396
|
|
|
392
397
|
content-1 (Here, this implies `False`)
|
|
393
398
|
content-2
|
|
@@ -396,7 +401,7 @@ input: content
|
|
|
396
401
|
|
|
397
402
|
if-content-prompt
|
|
398
403
|
|
|
399
|
-
- `
|
|
404
|
+
- `line=False`:
|
|
400
405
|
|
|
401
406
|
content-1
|
|
402
407
|
content-2
|
|
@@ -411,13 +416,13 @@ if-content-prompt
|
|
|
411
416
|
|
|
412
417
|
- **color_rgb**
|
|
413
418
|
|
|
414
|
-
The parameters for **color_rgb** are: data, r, g, b,
|
|
419
|
+
The parameters for **color_rgb** are: data, r, g, b, line.
|
|
415
420
|
|
|
416
|
-
**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 `
|
|
421
|
+
**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 `line` parameter requires no further explanation, as it was covered earlier!
|
|
417
422
|
|
|
418
423
|
- **color**
|
|
419
424
|
|
|
420
|
-
The parameters for **color** are: `data`, `text_color`, `bg_color`, `mode`, and `
|
|
425
|
+
The parameters for **color** are: `data`, `text_color`, `bg_color`, `mode`, and `line`.
|
|
421
426
|
|
|
422
427
|
**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.
|
|
423
428
|
|
|
@@ -1,250 +1,246 @@
|
|
|
1
|
-
from sys import platform, exit
|
|
2
|
-
from subprocess import run
|
|
3
|
-
from typing import Optional, Union
|
|
4
|
-
import shutil
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if
|
|
23
|
-
parts.append(str(
|
|
24
|
-
if
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
print(_ansi_rgb(data, r, g, b, mode), end=
|
|
61
|
-
|
|
62
|
-
def color(data: str, text_color: Optional[int] = None, bg_color: Optional[int] = None, mode: int = 0,
|
|
63
|
-
""" 输出彩色字符到控制台
|
|
64
|
-
|
|
65
|
-
参数:
|
|
66
|
-
data: 要输出的文本内容
|
|
67
|
-
text_color: 前景色代码 (30-37普通色, 90-97亮色)
|
|
68
|
-
bg_color: 背景色代码 (40-47普通色, 100-107亮色)
|
|
69
|
-
mode: 显示方式 (0=默认,1=粗体,2=暗淡,3=斜体,4=下划线,5=闪烁,7=反色,8=隐藏,9=删除线)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
示例:
|
|
73
|
-
color("错误信息", text_color=31, mode=1) # 红色加粗
|
|
74
|
-
color("警告", text_color=33, bg_color=41) # 黄字红底
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
"""
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
if
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
return
|
|
217
|
-
|
|
218
|
-
def
|
|
219
|
-
"""
|
|
220
|
-
return _safe_number(prompt,
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
print("\n===
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
name
|
|
245
|
-
|
|
246
|
-
height = safe_float("请输入身高(米) (Please Enter height (m)): ", text_color=34)
|
|
247
|
-
|
|
248
|
-
color(f"\n你好 {name}, 年龄 {age}, 身高 {height}m\nHello {name}, Age {age}, height {height}", text_color=32, mode=1)
|
|
249
|
-
|
|
1
|
+
from sys import platform, exit
|
|
2
|
+
from subprocess import run
|
|
3
|
+
from typing import Optional, Union
|
|
4
|
+
import shutil
|
|
5
|
+
import os
|
|
6
|
+
|
|
7
|
+
if os.name == "nt": # 系统名称 = "nt" 为 Windows
|
|
8
|
+
os.system("") # 激活 win10 / win7 的终端彩色显示功能
|
|
9
|
+
|
|
10
|
+
__version__ = "2.1.5" # 明确版本号
|
|
11
|
+
__all__ = [
|
|
12
|
+
'color', 'color_rgb', 'clear_screen',
|
|
13
|
+
'safe_input', 'safe_int', 'safe_float'
|
|
14
|
+
] # 确定导出后的代码可用的函数
|
|
15
|
+
|
|
16
|
+
class _AnsiCode: # AnsiCode 类
|
|
17
|
+
ESC = "\033"
|
|
18
|
+
RESET = f"{ESC}[0m"
|
|
19
|
+
@staticmethod
|
|
20
|
+
def build(mode: int = 0, fg: Optional[int] = None, bg: Optional[int] = None) -> str:
|
|
21
|
+
parts = []
|
|
22
|
+
if mode != 0:
|
|
23
|
+
parts.append(str(mode))
|
|
24
|
+
if fg is not None:
|
|
25
|
+
parts.append(str(fg))
|
|
26
|
+
if bg is not None:
|
|
27
|
+
parts.append(str(bg))
|
|
28
|
+
if parts:
|
|
29
|
+
return f"{_AnsiCode.ESC}[{';'.join(parts)}m"
|
|
30
|
+
return ""
|
|
31
|
+
|
|
32
|
+
def _ansi_return(data: str, text_color: Optional[int] = None, bg_color: Optional[int] = None, mode: int = 0) -> str: # 6767676767 ! 🐱
|
|
33
|
+
""" 生成ANSI彩色文本(不自动输出)
|
|
34
|
+
|
|
35
|
+
参数:
|
|
36
|
+
data: 要着色的文本内容
|
|
37
|
+
text_color: 前景色代码 (30-37普通色, 90-97亮色)
|
|
38
|
+
bg_color: 背景色代码 (40-47普通色, 100-107亮色)
|
|
39
|
+
mode: 显示方式 (0=默认,1=粗体,2=暗淡,3=斜体,4=下划线,5=闪烁,7=反色,8=隐藏,9=删除线)
|
|
40
|
+
|
|
41
|
+
返回:
|
|
42
|
+
带ANSI转义序列的字符串
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
if text_color is None and bg_color is None: # 如果 text_color 和 bg_color 不是 None
|
|
46
|
+
return data
|
|
47
|
+
|
|
48
|
+
ansi = _AnsiCode.build(mode, text_color, bg_color)
|
|
49
|
+
return f"{ansi}{data}{_AnsiCode.RESET}"
|
|
50
|
+
|
|
51
|
+
def _ansi_rgb(data: str, r: int, g: int, b: int, mode: int = 0) -> str:
|
|
52
|
+
""" 内部函数 """
|
|
53
|
+
if mode == 0:
|
|
54
|
+
return f"{_AnsiCode.ESC}[38;2;{r};{g};{b}m{data}{_AnsiCode.RESET}"
|
|
55
|
+
else:
|
|
56
|
+
return f"{_AnsiCode.ESC}[{mode};38;2;{r};{g};{b}m{data}{_AnsiCode.RESET}"
|
|
57
|
+
|
|
58
|
+
def color_rgb(data: str, r: int, g: int, b: int, mode: int = 0, line: int = 2) -> None: # 用户输出 RGB 彩色字符
|
|
59
|
+
""" 输出 rgb 字符 """
|
|
60
|
+
print(_ansi_rgb(data, r, g, b, mode), end="\n" * line)
|
|
61
|
+
|
|
62
|
+
def color(data: str, text_color: Optional[int] = None, bg_color: Optional[int] = None, mode: int = 0, line: int = 2) -> None: # 🤔
|
|
63
|
+
""" 输出彩色字符到控制台
|
|
64
|
+
|
|
65
|
+
参数:
|
|
66
|
+
data: 要输出的文本内容
|
|
67
|
+
text_color: 前景色代码 (30-37普通色, 90-97亮色)
|
|
68
|
+
bg_color: 背景色代码 (40-47普通色, 100-107亮色)
|
|
69
|
+
mode: 显示方式 (0=默认,1=粗体,2=暗淡,3=斜体,4=下划线,5=闪烁,7=反色,8=隐藏,9=删除线)
|
|
70
|
+
line: 是否在输出后添加空行,默认 2 空行,0 = 无空行
|
|
71
|
+
|
|
72
|
+
示例:
|
|
73
|
+
color("错误信息", text_color=31, mode=1) # 红色加粗
|
|
74
|
+
color("警告", text_color=33, bg_color=41) # 黄字红底
|
|
75
|
+
|
|
76
|
+
line 参数说明:
|
|
77
|
+
line 函数填入 int 类型的数字, 填入几就输出几个空行(print自带一个, 但是你可以不用管print, end不带print自带的空行)
|
|
78
|
+
实现代码部分:
|
|
79
|
+
|
|
80
|
+
< python
|
|
81
|
+
print(_ansi_return(data, text_color, bg_color, mode), end="\n" * line)
|
|
82
|
+
>
|
|
83
|
+
|
|
84
|
+
end="\n" * line
|
|
85
|
+
比如:
|
|
86
|
+
line = 2
|
|
87
|
+
为"空行数 = 2"的意思
|
|
88
|
+
|
|
89
|
+
line = 2
|
|
90
|
+
output:
|
|
91
|
+
content1 (This is line = 1)
|
|
92
|
+
content2
|
|
93
|
+
|
|
94
|
+
input: Luci
|
|
95
|
+
|
|
96
|
+
line = 0
|
|
97
|
+
HelloWorld (Hello和World是两个字符串)
|
|
98
|
+
"""
|
|
99
|
+
print(_ansi_return(data, text_color, bg_color, mode), end="\n" * line)
|
|
100
|
+
|
|
101
|
+
def clear_screen() -> None: # 清屏: 兼容版
|
|
102
|
+
""" 跨平台兼容清屏 """
|
|
103
|
+
try: # 检测环境
|
|
104
|
+
if platform == "win32": # 环境为 Windows
|
|
105
|
+
run(['cmd', '/c', 'cls']) # 安全: 使用列表命令, 防注入
|
|
106
|
+
else: # 包括 MacOS, Linux (Android 也是 Linux 列)
|
|
107
|
+
run(['clear'], check=False) # check = 遇到错误我 自己来, 别报错
|
|
108
|
+
except Exception: # 非交互式环境 (.py 打包.exe类环境等没 有cmd命令的环境)
|
|
109
|
+
try: # 最后一道防线
|
|
110
|
+
print("\n" * shutil.get_terminal_size().lines) # 根据终端输出相对应空行
|
|
111
|
+
except: # 为了防止用户让终端的长度无法获取
|
|
112
|
+
print("\n" * 250) # 防止获取不到终端长度的输出
|
|
113
|
+
|
|
114
|
+
def _safe_try_except(prompt, input_type = True, convert_func=None, text_color=None, bg_color=None, mode=0) -> Union[str, int, float]: # True = input 模式 : False = int / float 模式
|
|
115
|
+
if text_color is not None or bg_color is not None:
|
|
116
|
+
prompt = _ansi_return(prompt, text_color, bg_color, mode)
|
|
117
|
+
while True:
|
|
118
|
+
try:
|
|
119
|
+
if input_type:
|
|
120
|
+
return input(prompt)
|
|
121
|
+
else:
|
|
122
|
+
return convert_func(input(prompt))
|
|
123
|
+
except MemoryError:
|
|
124
|
+
color("OUT OF MEMORY !\n\nInsufficient memory to complete the operation.\n\nTry:\n\n· Close other apps and retry\n· Increase RAM or swap space\n· Restart the system if problem persists\nOperation terminated. (Error 0x0000005E)\n\n内存不足!\n\n内存不足,无法完成操作。\n\n请尝试:\n\n· 关闭其他应用后重试\n· 增加内存或交换空间\n· 如果问题仍然存在,请重启系 统\n操作已终止 (错误代码 0x0000005E)", 37, 44, 1)
|
|
125
|
+
exit(1)
|
|
126
|
+
except ValueError:
|
|
127
|
+
print("Invalid input value type\n无效的输入值类型")
|
|
128
|
+
continue
|
|
129
|
+
except KeyboardInterrupt:
|
|
130
|
+
clear_screen()
|
|
131
|
+
color("Program interrupted\n程序被中断", 33, None, 1)
|
|
132
|
+
exit(0)
|
|
133
|
+
except EOFError:
|
|
134
|
+
clear_screen()
|
|
135
|
+
color("Input stream terminated\n输入流已终止", 33, None, 1)
|
|
136
|
+
exit(0)
|
|
137
|
+
except TimeoutError:
|
|
138
|
+
color("Input timeout\n输入超时", 33, None, 1)
|
|
139
|
+
exit(0)
|
|
140
|
+
except UnicodeDecodeError:
|
|
141
|
+
color("Unicode encoding error\nUnicode 编码错误", 33, None, 1)
|
|
142
|
+
continue
|
|
143
|
+
except OSError:
|
|
144
|
+
color("OSError: System operation failed. Please check file path, permissions, or disk space.\nOSError:系统操作失败。请检查文件路径、权限或磁盘空间。", 37, 44, 1)
|
|
145
|
+
exit(1)
|
|
146
|
+
except OverflowError:
|
|
147
|
+
color("Value overflow\n数值溢出", 33, None, 1)
|
|
148
|
+
continue
|
|
149
|
+
except TypeError:
|
|
150
|
+
color("Type conversion failed\n类型转换失败", 33, None, 1)
|
|
151
|
+
continue
|
|
152
|
+
except RuntimeError as e:
|
|
153
|
+
color(f"Serious runtime error\nError message:\n{e}\n严重的运行时错误\n错误信息,\n{e}", 33, None, 1)
|
|
154
|
+
exit(1)
|
|
155
|
+
except SystemExit:
|
|
156
|
+
color("System exit\n系统退出", 33, None, 1)
|
|
157
|
+
exit(0)
|
|
158
|
+
except SystemError:
|
|
159
|
+
color("System error, please check Python interpreter\n系统错误,请检查 Python 解释器", 33, None, 1)
|
|
160
|
+
exit(0)
|
|
161
|
+
except AttributeError:
|
|
162
|
+
color("Object has no such attribute\n对象没有此属性", 33, None, 1)
|
|
163
|
+
continue
|
|
164
|
+
except NameError:
|
|
165
|
+
color("Variable or function not defined\n变量或函数未定义", 33, None, 1)
|
|
166
|
+
exit(1)
|
|
167
|
+
except SyntaxError:
|
|
168
|
+
color("Syntax error in code\n代码中的语法错误", 33, None, 1)
|
|
169
|
+
continue
|
|
170
|
+
except RecursionError:
|
|
171
|
+
color("Recursion depth exceeded\n超出递归深度", 33, None, 1)
|
|
172
|
+
exit(1)
|
|
173
|
+
except BrokenPipeError:
|
|
174
|
+
color("Input pipe closed by other end\n输入管道被另一端关闭", 33, None, 1)
|
|
175
|
+
exit(1)
|
|
176
|
+
except ConnectionError:
|
|
177
|
+
color("Input from network stream and connection lost\n来自网络流的输入,连接已丢失", 33, None, 1)
|
|
178
|
+
exit(1)
|
|
179
|
+
except FileNotFoundError:
|
|
180
|
+
color("Input source file not found\n未找到输入源 文件", 33, None, 1)
|
|
181
|
+
exit(1)
|
|
182
|
+
except IsADirectoryError:
|
|
183
|
+
color("Input source is a directory, not a file\n 输入源是一个目录,而不是文件", 33, None, 1)
|
|
184
|
+
exit(1)
|
|
185
|
+
except PermissionError:
|
|
186
|
+
color("Permission denied to read input source\n权限被拒绝,无法读取输入源", 33, None, 1)
|
|
187
|
+
exit(1)
|
|
188
|
+
except BlockingIOError:
|
|
189
|
+
color("No data to read in non-blocking mode\n非阻塞模式下没有数据可读", 33, None, 1)
|
|
190
|
+
continue
|
|
191
|
+
except ChildProcessError:
|
|
192
|
+
color("Child process operation failed\n子进程操作失败", 33, None, 1)
|
|
193
|
+
exit(1)
|
|
194
|
+
except InterruptedError:
|
|
195
|
+
color("System call interrupted by signal\n系统调 用被信号中断", 33, None, 1)
|
|
196
|
+
continue
|
|
197
|
+
except StopIteration:
|
|
198
|
+
color("Custom iterator input exhausted\n自定义迭 代器输入已耗尽", 33, None, 1)
|
|
199
|
+
continue
|
|
200
|
+
except GeneratorExit:
|
|
201
|
+
color("Generator closed\n生成器已关闭", 33, None, 1)
|
|
202
|
+
continue
|
|
203
|
+
except Exception as e:
|
|
204
|
+
color(f"Code error\nError message:\n{e}\n代码错误\n错误信息:\n{e}", 33, None, 1)
|
|
205
|
+
continue
|
|
206
|
+
# 27 个 except
|
|
207
|
+
|
|
208
|
+
def safe_input(prompt, text_color=None, bg_color=None, mode=0) -> str:
|
|
209
|
+
return _safe_try_except(prompt, True, None, text_color, bg_color, mode)
|
|
210
|
+
|
|
211
|
+
def _safe_number(prompt, convert_func, text_color=None, bg_color=None, mode=0) -> Union[int, float]:
|
|
212
|
+
return _safe_try_except(prompt, False, convert_func, text_color, bg_color, mode)
|
|
213
|
+
|
|
214
|
+
def safe_int(prompt: str, text_color: Optional[int] = None, bg_color: Optional[int] = None, mode: int = 0) -> int:
|
|
215
|
+
""" 安全输出整数 """
|
|
216
|
+
return _safe_number(prompt, int, text_color, bg_color, mode)
|
|
217
|
+
|
|
218
|
+
def safe_float(prompt: str, text_color: Optional[int] = None, bg_color: Optional[int] = None, mode: int = 0) -> float:
|
|
219
|
+
""" 安全输出浮点数 """
|
|
220
|
+
return _safe_number(prompt, float, text_color, bg_color, mode)
|
|
221
|
+
|
|
222
|
+
# -- 测试部分 -- #
|
|
223
|
+
if __name__ == "__main__":
|
|
224
|
+
print("=== 测试基本颜色 ===\n=== Test basic colors ===")
|
|
225
|
+
color("红色文本\nRed text", text_color=31)
|
|
226
|
+
color("绿色加粗\nGreen bold", text_color=32, mode=1)
|
|
227
|
+
color("黄字红底\nYellow text Red background", text_color=33, bg_color=41)
|
|
228
|
+
color("红字黄底加粗\nRed text Yellow background Bold", text_color=31, bg_color=43, mode=1)
|
|
229
|
+
|
|
230
|
+
print("\n=== 测试RGB颜色 ===\n=== Test RGB colors ===")
|
|
231
|
+
color_rgb("RGB红色\nRGB Red", r=255, g=0, b=0)
|
|
232
|
+
color_rgb("RGB绿色加粗\nRGB Green Bold", r=0, g=255, b=0, mode=1)
|
|
233
|
+
|
|
234
|
+
print("\n=== 测试清屏 ===\n=== Test Clear Screen ===")
|
|
235
|
+
safe_input("按回车清屏...\nPress Enter to clear screen", 32, None, 1)
|
|
236
|
+
clear_screen()
|
|
237
|
+
color("清屏成功\nScreen cleared successfully", text_color=32, mode=1)
|
|
238
|
+
|
|
239
|
+
print('\n=== 测试"输入"函数 ===\n=== Test "Input" Functions ===')
|
|
240
|
+
name = safe_input("请输入名字(Please Enter Name): ", text_color=36)
|
|
241
|
+
age = safe_int("请输入年龄(Please Enter Age): ", text_color=33)
|
|
242
|
+
height = safe_float("请输入身高(米) (Please Enter height (m)): ", text_color=34)
|
|
243
|
+
|
|
244
|
+
color(f"\n你好 {name}, 年龄 {age}, 身高 {height}m\nHello {name}, Age {age}, height {height}", text_color=32, mode=1)
|
|
245
|
+
|
|
250
246
|
print("\n所有测试完成!\nAll Tests successfully!")
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: Luci-Code-Tools
|
|
3
|
-
Version: 2.1.
|
|
4
|
-
Summary:
|
|
5
|
-
Home-page: https://github.com/Luci-
|
|
3
|
+
Version: 2.1.5
|
|
4
|
+
Summary: 一个简单的工具库 / A Eazy Tools Module
|
|
5
|
+
Home-page: https://github.com/Luci-Code-2014
|
|
6
6
|
Author: Luci_Code
|
|
7
7
|
Author-email: 3967742419@qq.com
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -20,7 +20,7 @@ Dynamic: license-file
|
|
|
20
20
|
Dynamic: requires-python
|
|
21
21
|
Dynamic: summary
|
|
22
22
|
|
|
23
|
-
[](https://pypi.org/project/Luci_Code_Tools/)
|
|
24
24
|
|
|
25
25
|
[]()
|
|
26
26
|
|
|
@@ -118,8 +118,8 @@ MIT Licence (c) Luci_Code
|
|
|
118
118
|
|
|
119
119
|
| 函数名 | 功能 | 参数列表 |
|
|
120
120
|
| --- | --- | --- |
|
|
121
|
-
| color_rgb | 输出真彩色文本, 支持 rgb 调色 | data, r, g, b,
|
|
122
|
-
| color | 输出 ANSI 转义序列固定颜色, 适合不会调色的开发者 | data, text_color, bg_color, mode,
|
|
121
|
+
| color_rgb | 输出真彩色文本, 支持 rgb 调色 | data, r, g, b, line |
|
|
122
|
+
| color | 输出 ANSI 转义序列固定颜色, 适合不会调色的开发者 | data, text_color, bg_color, mode, line |
|
|
123
123
|
| clear_screen | 在任意系统下都能清屏的函数 | 无参数 |
|
|
124
124
|
| safe_input | 让用户安全的输入字符串 | prompt, text_color, bg_color, mode |
|
|
125
125
|
| safe_int | 让用户安全的输入整数 | prompt, text_color, bg_color, mode |
|
|
@@ -129,27 +129,32 @@ MIT Licence (c) Luci_Code
|
|
|
129
129
|
|
|
130
130
|
# 参数使用教程
|
|
131
131
|
|
|
132
|
-
**
|
|
132
|
+
**line** 是指在原本的基础上再输出 ** {num} ** 行, 默认为 2 (多一行)
|
|
133
133
|
|
|
134
134
|
***输出效果:***
|
|
135
135
|
|
|
136
|
-
|
|
136
|
+
line = 1 : [
|
|
137
|
+
content1
|
|
138
|
+
content2
|
|
139
|
+
input: Luci
|
|
140
|
+
]
|
|
137
141
|
|
|
138
|
-
|
|
139
|
-
|
|
142
|
+
line = 2 : [
|
|
143
|
+
content1 (line = 1)
|
|
144
|
+
content2
|
|
140
145
|
|
|
141
|
-
input:
|
|
146
|
+
input: Luci
|
|
147
|
+
]
|
|
142
148
|
|
|
143
|
-
|
|
149
|
+
line = 3 : [
|
|
150
|
+
content1 (line = 1)
|
|
151
|
+
content2
|
|
144
152
|
|
|
145
|
-
- newline=False :
|
|
146
153
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
input: content
|
|
150
|
-
if-content-prompt
|
|
154
|
+
input: Luci
|
|
155
|
+
]
|
|
151
156
|
|
|
152
|
-
|
|
157
|
+
**这一改动让命令行的输出变得有辨识度**
|
|
153
158
|
|
|
154
159
|
**data, prompt** 都是 *输出的文本* 的意思
|
|
155
160
|
|
|
@@ -157,13 +162,13 @@ if-content-prompt
|
|
|
157
162
|
|
|
158
163
|
- **color_rgb**
|
|
159
164
|
|
|
160
|
-
**color_rgb** 的参数有: data, r, g, b,
|
|
165
|
+
**color_rgb** 的参数有: data, r, g, b, line
|
|
161
166
|
|
|
162
|
-
**其中**, data 是数据的意思, 代表输出的内容, [r, g, b] 是 ***标准 rgb 调色*** 的用处, 所以 [r, g, b] 分别填入 r, g, b 的值,
|
|
167
|
+
**其中**, data 是数据的意思, 代表输出的内容, [r, g, b] 是 ***标准 rgb 调色*** 的用处, 所以 [r, g, b] 分别填入 r, g, b 的值, line 不用讲解, 前面说了喵
|
|
163
168
|
|
|
164
169
|
- **color**
|
|
165
170
|
|
|
166
|
-
**color** 的参数有: data, text_color, bg_color, mode,
|
|
171
|
+
**color** 的参数有: data, text_color, bg_color, mode, line
|
|
167
172
|
|
|
168
173
|
**data** 和之前一样, ***[text_color, bg_color, mode]***, 这三个参数在 safe_\* 中也有, 意思相同, 暂不讲解, **text_color** 就是控制输出的文本的颜色**(前景色)**, bg_color** 是输出文本的**背景色**, **mode** 为输出的格式 **(显示方式)**, 这三个参数在最后会有**表格对照表**
|
|
169
174
|
|
|
@@ -372,8 +377,8 @@ MIT License (c) Luci_Code
|
|
|
372
377
|
|
|
373
378
|
| Function Name | Functionality | Parameter List |
|
|
374
379
|
| --- | --- | --- |
|
|
375
|
-
| color_rgb | Outputs true-color text; supports RGB color customization. | data, r, g, b,
|
|
376
|
-
| color | Outputs text using fixed ANSI escape sequence colors; suitable for developers unfamiliar with color mixing. | data, text_color, bg_color, mode,
|
|
380
|
+
| color_rgb | Outputs true-color text; supports RGB color customization. | data, r, g, b, line |
|
|
381
|
+
| color | Outputs text using fixed ANSI escape sequence colors; suitable for developers unfamiliar with color mixing. | data, text_color, bg_color, mode, line |
|
|
377
382
|
| clear_screen | A function that clears the screen on any operating system. | No parameters |
|
|
378
383
|
| safe_input | Safely prompts the user to input a string. | prompt, text_color, bg_color, mode |
|
|
379
384
|
| safe_int | Safely prompts the user to input an integer. | prompt, text_color, bg_color, mode |
|
|
@@ -383,11 +388,11 @@ MIT License (c) Luci_Code
|
|
|
383
388
|
|
|
384
389
|
# Parameter Usage Guide
|
|
385
390
|
|
|
386
|
-
**
|
|
391
|
+
**line** refers to whether an additional line break is added after the output; it defaults to `True` (adding an extra line).
|
|
387
392
|
|
|
388
393
|
***Output Effect:***
|
|
389
394
|
|
|
390
|
-
- `
|
|
395
|
+
- `line=True`:
|
|
391
396
|
|
|
392
397
|
content-1 (Here, this implies `False`)
|
|
393
398
|
content-2
|
|
@@ -396,7 +401,7 @@ input: content
|
|
|
396
401
|
|
|
397
402
|
if-content-prompt
|
|
398
403
|
|
|
399
|
-
- `
|
|
404
|
+
- `line=False`:
|
|
400
405
|
|
|
401
406
|
content-1
|
|
402
407
|
content-2
|
|
@@ -411,13 +416,13 @@ if-content-prompt
|
|
|
411
416
|
|
|
412
417
|
- **color_rgb**
|
|
413
418
|
|
|
414
|
-
The parameters for **color_rgb** are: data, r, g, b,
|
|
419
|
+
The parameters for **color_rgb** are: data, r, g, b, line.
|
|
415
420
|
|
|
416
|
-
**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 `
|
|
421
|
+
**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 `line` parameter requires no further explanation, as it was covered earlier!
|
|
417
422
|
|
|
418
423
|
- **color**
|
|
419
424
|
|
|
420
|
-
The parameters for **color** are: `data`, `text_color`, `bg_color`, `mode`, and `
|
|
425
|
+
The parameters for **color** are: `data`, `text_color`, `bg_color`, `mode`, and `line`.
|
|
421
426
|
|
|
422
427
|
**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.
|
|
423
428
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[](https://pypi.org/project/Luci_Code_Tools/)
|
|
2
2
|
|
|
3
3
|
[]()
|
|
4
4
|
|
|
@@ -96,8 +96,8 @@ MIT Licence (c) Luci_Code
|
|
|
96
96
|
|
|
97
97
|
| 函数名 | 功能 | 参数列表 |
|
|
98
98
|
| --- | --- | --- |
|
|
99
|
-
| color_rgb | 输出真彩色文本, 支持 rgb 调色 | data, r, g, b,
|
|
100
|
-
| color | 输出 ANSI 转义序列固定颜色, 适合不会调色的开发者 | data, text_color, bg_color, mode,
|
|
99
|
+
| color_rgb | 输出真彩色文本, 支持 rgb 调色 | data, r, g, b, line |
|
|
100
|
+
| color | 输出 ANSI 转义序列固定颜色, 适合不会调色的开发者 | data, text_color, bg_color, mode, line |
|
|
101
101
|
| clear_screen | 在任意系统下都能清屏的函数 | 无参数 |
|
|
102
102
|
| safe_input | 让用户安全的输入字符串 | prompt, text_color, bg_color, mode |
|
|
103
103
|
| safe_int | 让用户安全的输入整数 | prompt, text_color, bg_color, mode |
|
|
@@ -107,27 +107,32 @@ MIT Licence (c) Luci_Code
|
|
|
107
107
|
|
|
108
108
|
# 参数使用教程
|
|
109
109
|
|
|
110
|
-
**
|
|
110
|
+
**line** 是指在原本的基础上再输出 ** {num} ** 行, 默认为 2 (多一行)
|
|
111
111
|
|
|
112
112
|
***输出效果:***
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
line = 1 : [
|
|
115
|
+
content1
|
|
116
|
+
content2
|
|
117
|
+
input: Luci
|
|
118
|
+
]
|
|
115
119
|
|
|
116
|
-
|
|
117
|
-
|
|
120
|
+
line = 2 : [
|
|
121
|
+
content1 (line = 1)
|
|
122
|
+
content2
|
|
118
123
|
|
|
119
|
-
input:
|
|
124
|
+
input: Luci
|
|
125
|
+
]
|
|
120
126
|
|
|
121
|
-
|
|
127
|
+
line = 3 : [
|
|
128
|
+
content1 (line = 1)
|
|
129
|
+
content2
|
|
122
130
|
|
|
123
|
-
- newline=False :
|
|
124
131
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
input: content
|
|
128
|
-
if-content-prompt
|
|
132
|
+
input: Luci
|
|
133
|
+
]
|
|
129
134
|
|
|
130
|
-
|
|
135
|
+
**这一改动让命令行的输出变得有辨识度**
|
|
131
136
|
|
|
132
137
|
**data, prompt** 都是 *输出的文本* 的意思
|
|
133
138
|
|
|
@@ -135,13 +140,13 @@ if-content-prompt
|
|
|
135
140
|
|
|
136
141
|
- **color_rgb**
|
|
137
142
|
|
|
138
|
-
**color_rgb** 的参数有: data, r, g, b,
|
|
143
|
+
**color_rgb** 的参数有: data, r, g, b, line
|
|
139
144
|
|
|
140
|
-
**其中**, data 是数据的意思, 代表输出的内容, [r, g, b] 是 ***标准 rgb 调色*** 的用处, 所以 [r, g, b] 分别填入 r, g, b 的值,
|
|
145
|
+
**其中**, data 是数据的意思, 代表输出的内容, [r, g, b] 是 ***标准 rgb 调色*** 的用处, 所以 [r, g, b] 分别填入 r, g, b 的值, line 不用讲解, 前面说了喵
|
|
141
146
|
|
|
142
147
|
- **color**
|
|
143
148
|
|
|
144
|
-
**color** 的参数有: data, text_color, bg_color, mode,
|
|
149
|
+
**color** 的参数有: data, text_color, bg_color, mode, line
|
|
145
150
|
|
|
146
151
|
**data** 和之前一样, ***[text_color, bg_color, mode]***, 这三个参数在 safe_\* 中也有, 意思相同, 暂不讲解, **text_color** 就是控制输出的文本的颜色**(前景色)**, bg_color** 是输出文本的**背景色**, **mode** 为输出的格式 **(显示方式)**, 这三个参数在最后会有**表格对照表**
|
|
147
152
|
|
|
@@ -350,8 +355,8 @@ MIT License (c) Luci_Code
|
|
|
350
355
|
|
|
351
356
|
| Function Name | Functionality | Parameter List |
|
|
352
357
|
| --- | --- | --- |
|
|
353
|
-
| color_rgb | Outputs true-color text; supports RGB color customization. | data, r, g, b,
|
|
354
|
-
| color | Outputs text using fixed ANSI escape sequence colors; suitable for developers unfamiliar with color mixing. | data, text_color, bg_color, mode,
|
|
358
|
+
| color_rgb | Outputs true-color text; supports RGB color customization. | data, r, g, b, line |
|
|
359
|
+
| color | Outputs text using fixed ANSI escape sequence colors; suitable for developers unfamiliar with color mixing. | data, text_color, bg_color, mode, line |
|
|
355
360
|
| clear_screen | A function that clears the screen on any operating system. | No parameters |
|
|
356
361
|
| safe_input | Safely prompts the user to input a string. | prompt, text_color, bg_color, mode |
|
|
357
362
|
| safe_int | Safely prompts the user to input an integer. | prompt, text_color, bg_color, mode |
|
|
@@ -361,11 +366,11 @@ MIT License (c) Luci_Code
|
|
|
361
366
|
|
|
362
367
|
# Parameter Usage Guide
|
|
363
368
|
|
|
364
|
-
**
|
|
369
|
+
**line** refers to whether an additional line break is added after the output; it defaults to `True` (adding an extra line).
|
|
365
370
|
|
|
366
371
|
***Output Effect:***
|
|
367
372
|
|
|
368
|
-
- `
|
|
373
|
+
- `line=True`:
|
|
369
374
|
|
|
370
375
|
content-1 (Here, this implies `False`)
|
|
371
376
|
content-2
|
|
@@ -374,7 +379,7 @@ input: content
|
|
|
374
379
|
|
|
375
380
|
if-content-prompt
|
|
376
381
|
|
|
377
|
-
- `
|
|
382
|
+
- `line=False`:
|
|
378
383
|
|
|
379
384
|
content-1
|
|
380
385
|
content-2
|
|
@@ -389,13 +394,13 @@ if-content-prompt
|
|
|
389
394
|
|
|
390
395
|
- **color_rgb**
|
|
391
396
|
|
|
392
|
-
The parameters for **color_rgb** are: data, r, g, b,
|
|
397
|
+
The parameters for **color_rgb** are: data, r, g, b, line.
|
|
393
398
|
|
|
394
|
-
**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 `
|
|
399
|
+
**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 `line` parameter requires no further explanation, as it was covered earlier!
|
|
395
400
|
|
|
396
401
|
- **color**
|
|
397
402
|
|
|
398
|
-
The parameters for **color** are: `data`, `text_color`, `bg_color`, `mode`, and `
|
|
403
|
+
The parameters for **color** are: `data`, `text_color`, `bg_color`, `mode`, and `line`.
|
|
399
404
|
|
|
400
405
|
**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.
|
|
401
406
|
|
|
@@ -5,17 +5,17 @@ with open("README.md", "r", encoding="utf-8") as f:
|
|
|
5
5
|
|
|
6
6
|
setup(
|
|
7
7
|
name="Luci-Code-Tools",
|
|
8
|
-
version="2.1.
|
|
8
|
+
version="2.1.5",
|
|
9
9
|
author="Luci_Code",
|
|
10
10
|
author_email="3967742419@qq.com",
|
|
11
|
-
description="
|
|
11
|
+
description="一个简单的工具库 / A Eazy Tools Module",
|
|
12
12
|
long_description=long_description,
|
|
13
13
|
long_description_content_type="text/markdown",
|
|
14
|
-
url="https://github.com/Luci-
|
|
14
|
+
url="https://github.com/Luci-Code-2014",
|
|
15
15
|
py_modules=["Luci_code_tools"],
|
|
16
16
|
classifiers=[
|
|
17
17
|
"Programming Language :: Python :: 3",
|
|
18
18
|
"License :: OSI Approved :: MIT License",
|
|
19
19
|
],
|
|
20
|
-
python_requires=">=3.6"
|
|
20
|
+
python_requires=">=3.6"
|
|
21
21
|
)
|
|
File without changes
|
|
File without changes
|
{luci_code_tools-2.1.3 → luci_code_tools-2.1.5}/Luci_Code_Tools.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|