当前位置:网站首页>2 lines of code to generate a solid desktop background
2 lines of code to generate a solid desktop background
2022-07-25 21:48:00 【Interesting Python】
2 Lines of code to achieve a solid desktop background
The core code is just 2 That's ok
Use PIL The library generates a solid color map at a certain resolution
Color code can be referred to : Chinese traditional color collection [1]
The code is as follows :
# coding: utf-8
# Python Solid color diagram
from PIL import Image
SIZE = (1920, 1080)
COLORS = [
("#ff461f", " Cinnabar "),
("#ff2d51", " fiery "),
("#ed5736", " Feise "),
("#f00056", " magenta "),
("#db5a6b", " Begonia red "),
("#c93756", " Cherry "),
("#ff2121", " bright red "),
("#c83c23", " crimson "),
("#9d2933", " Rouge "),
("#ff4c00", " Vermilion "),
("#ff4e20", " Dan "),
("#f35336", " Tong "),
("#cb3a56", " Alizarin "),
("#ff3300", " inflammation "),
("#ff0097", " Magenta "),
("#c32136", " Zaohong "),
("#bf242a", " Silver and Zhu "),
("#c3272b", " red "),
("#dc3023", " Blush "),
("#f05654", " Silver Red "),
]
for index,C in enumerate(COLORS):
im = Image.new('RGB', SIZE, C[0])
im.save('images/{0:02d}'.format(index) + C[1] + '.jpg', quality=95)Code brief description :
SIZE It's resolution , You can adjust it according to your needs
COLORS Is the color code and the corresponding color name
Need to add color COLORS Just add it inside
Wechat insists that this article is not original , I don't know whether it's too many punctuation spaces, not enough words, or whether the written code is similar to others and has been checked again , Here is a lot of useless nonsense of barabarabara, adding up a word effect , I don't know if I can ? If you can see this nonsense , That's enough . ha-ha
design sketch :

Vermilion :




Reference material
[1]
Chinese traditional color collection : https://www.chinavid.com/chinese-color.html
边栏推荐
- Job interviews are always a second kill? After reading the seckill system notes secretly stored by JD T8, I have given my knees
- 2022 latest examination questions and answers of eight members (standard staff) of Shanghai Architecture
- 字节一面:TCP 和 UDP 可以使用同一个端口吗?
- QT | learn about QT creator by creating a simple project
- ag 搜索工具参数详解
- [interview: concurrent 25: multithreading: volatile] visibility
- IJCAI2022开会了! 微软等《领域泛化Domain Generalization》教程
- Shopify sellers: share some tips for social media marketing!
- In Oracle 19C version, logminer package continuous_ The outdated function of mine leads to CDC failure
- Face and key point detection: yolo5face practice
猜你喜欢

Bitcoin.com:usdd represents a truly decentralized stable currency

Sentinel vs Hystrix 限流对比,到底怎么选?

Zero basic learning canoe panel (17) -- panel CAPL function

【leetcode天梯】链表 · 876 查找链表中间结点

Optimization analysis of storage structure and IO performance of openharmony littlefs file system

Reading the pointpillar code of openpcdet -- Part 3: Calculation of loss function

函数栈帧的创建和销毁

MySQL master-slave configuration
![[MAIXPY]kpu: load error:2005, ERR_ READ_ File: read file failed problem solving](/img/0b/da67b5a361a2cdfaf81568d34cf5f7.png)
[MAIXPY]kpu: load error:2005, ERR_ READ_ File: read file failed problem solving

I'm also drunk. Eureka delayed registration and this pit!
随机推荐
立创EDA——我为什么要学EDA
【Redis底层解析】字符串类型
Isn't it too much to play Gobang in idea?
【饭谈】软件测试薪资层次和分段(修仙)
我也是醉了,Eureka 延迟注册还有这个坑!
How to solve the problem of high concurrency and large traffic with PHP
Research: more than 70% of doctors are still prescribing unsafe antibiotic drugs
[interview: concurrent 25: multithreading: volatile] visibility
函数栈帧的创建和销毁
strcpy()
Composition of dog food
Redis usage details
[introduction to C language] zzulioj 1016-1020
MySQL master-slave configuration
Create EDA - why should I learn EDA
【面试:并发篇23:多线程:join】join再理解
Configuration and use of multithreading
[redis underlying parsing] linked list type
PE format: analyze and implement IATHOOK
Idea resolves the prompt of profile properties disappear