📖 简介

基于 React + Tailwind CSS 构建的专业颜色转换工具,支持多种颜色格式的实时转换。无论是设计师、开发者,都能在这个工具中找到所需的颜色转换功能。

✨ 核心功能

🎯 多格式颜色转换

  • HEX 格式: 支持 3 位缩写 (#000#fff) 和 6 位完整格式 (#ff6b6b)
  • RGB/RGBA: 红绿蓝颜色空间,支持透明度
  • HSL/HSLA: 色相饱和度亮度,更直观的颜色表示
  • HSV: 色相饱和度明度,常用于图像处理
  • CMYK: 青品黄黑,印刷行业标准

🌟 亮点

全面的颜色空间支持

// 支持的颜色格式示例
#ff6b6b          // HEX 6位
#f66             // HEX 3位缩写
rgb(255, 107, 107)           // RGB
rgba(255, 107, 107, 0.8)     // RGBA
hsl(0, 100%, 71%)            // HSL
hsla(0, 100%, 71%, 0.8)      // HSLA
hsv(0, 58%, 100%)            // HSV
cmyk(0%, 58%, 58%, 0%)       // CMYK

🎯 使用场景

  • CSS 开发: 快速获取不同格式的颜色值用于样式开发
  • 主题系统: 构建多主题应用时的颜色格式转换
  • 调试工具: 快速验证和转换颜色值

💻 核心代码实现

1. HEX 到 RGB 转换(支持缩写)

const hexToRgb = (hex) => {// 支持 3 位 HEX 缩写,如 #000, #fffif (/^#?([a-f\d])([a-f\d])([a-f\d])$/i.test(hex)) {const result = /^#?([a-f\d])([a-f\d])([a-f\d])$/i.exec(hex);return {r: parseInt(result[1] + result[1], 16),g: parseInt(result[2] + result[2], 16),b: parseInt(result[3] + result[3], 16),};}// 支持 6 位 HEX,如 #000000, #ffffffconst result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);return result? {r: parseInt(result[1], 16),g: parseInt(result[2], 16),b: parseInt(result[3], 16),}: null;
};

2. RGB 到 HEX 转换

const rgbToHex = (r, g, b) => {return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
};

3. RGB 到 HSL 转换

const rgbToHsl = (r, g, b) => {r /= 255;g /= 255;b /= 255;const max = Math.max(r, g, b);const min = Math.min(r, g, b);let h,s,l = (max + min) / 2;if (max === min) {h = s = 0;} else {const d = max - min;s = l > 0.5 ? d / (2 - max - min) : d / (max + min);switch (max) {case r:h = (g - b) / d + (g < b ? 6 : 0);break;case g:h = (b - r) / d + 2;break;case b:h = (r - g) / d + 4;break;}h /= 6;}return {h: Math.round(h * 360),s: Math.round(s * 100),l: Math.round(l * 100),};
};

4. HSL 到 RGB 转换

const hslToRgb = (h, s, l) => {h /= 360;s /= 100;l /= 100;const hue2rgb = (p, q, t) => {if (t < 0) t += 1;if (t > 1) t -= 1;if (t < 1 / 6) return p + (q - p) * 6 * t;if (t < 1 / 2) return q;if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;return p;};let r, g, b;if (s === 0) {r = g = b = l;} else {const q = l < 0.5 ? l * (1 + s) : l + s - l * s;const p = 2 * l - q;r = hue2rgb(p, q, h + 1 / 3);g = hue2rgb(p, q, h);b = hue2rgb(p, q, h - 1 / 3);}return {r: Math.round(r * 255),g: Math.round(g * 255),b: Math.round(b * 255),};
};

5. RGB 到 HSV 转换

const rgbToHsv = (r, g, b) => {r /= 255;g /= 255;b /= 255;const max = Math.max(r, g, b);const min = Math.min(r, g, b);const d = max - min;let h,s,v = max;s = max === 0 ? 0 : d / max;if (max === min) {h = 0;} else {switch (max) {case r:h = (g - b) / d + (g < b ? 6 : 0);break;case g:h = (b - r) / d + 2;break;case b:h = (r - g) / d + 4;break;}h /= 6;}return {h: Math.round(h * 360),s: Math.round(s * 100),v: Math.round(v * 100),};
};

6. RGB 到 CMYK 转换

const rgbToCmyk = (r, g, b) => {r /= 255;g /= 255;b /= 255;const k = 1 - Math.max(r, g, b);const c = (1 - r - k) / (1 - k);const m = (1 - g - k) / (1 - k);const y = (1 - b - k) / (1 - k);return {c: Math.round(c * 100),m: Math.round(m * 100),y: Math.round(y * 100),k: Math.round(k * 100),};
};

完整源码

📖 项目简介

基于 React + Tailwind CSS 构建的专业颜色转换工具,支持多种颜色格式的实时转换。无论是设计师、开发者,都能在这个工具中找到所需的颜色转换功能。

✨ 核心功能

🎯 多格式颜色转换

  • HEX 格式: 支持 3 位缩写 (#000#fff) 和 6 位完整格式 (#ff6b6b)
  • RGB/RGBA: 红绿蓝颜色空间,支持透明度
  • HSL/HSLA: 色相饱和度亮度,更直观的颜色表示
  • HSV: 色相饱和度明度,常用于图像处理
  • CMYK: 青品黄黑,印刷行业标准

🌟 亮点

全面的颜色空间支持

// 支持的颜色格式示例
#ff6b6b          // HEX 6位
#f66             // HEX 3位缩写
rgb(255, 107, 107)           // RGB
rgba(255, 107, 107, 0.8)     // RGBA
hsl(0, 100%, 71%)            // HSL
hsla(0, 100%, 71%, 0.8)      // HSLA
hsv(0, 58%, 100%)            // HSV
cmyk(0%, 58%, 58%, 0%)       // CMYK

🎯 使用场景

  • CSS 开发: 快速获取不同格式的颜色值用于样式开发
  • 主题系统: 构建多主题应用时的颜色格式转换
  • 调试工具: 快速验证和转换颜色值

💻 核心代码实现

1. HEX 到 RGB 转换(支持缩写)

const hexToRgb = (hex) => {// 支持 3 位 HEX 缩写,如 #000, #fffif (/^#?([a-f\d])([a-f\d])([a-f\d])$/i.test(hex)) {const result = /^#?([a-f\d])([a-f\d])([a-f\d])$/i.exec(hex);return {r: parseInt(result[1] + result[1], 16),g: parseInt(result[2] + result[2], 16),b: parseInt(result[3] + result[3], 16),};}// 支持 6 位 HEX,如 #000000, #ffffffconst result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);return result? {r: parseInt(result[1], 16),g: parseInt(result[2], 16),b: parseInt(result[3], 16),}: null;
};

2. RGB 到 HEX 转换

const rgbToHex = (r, g, b) => {return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
};

3. RGB 到 HSL 转换

const rgbToHsl = (r, g, b) => {r /= 255;g /= 255;b /= 255;const max = Math.max(r, g, b);const min = Math.min(r, g, b);let h,s,l = (max + min) / 2;if (max === min) {h = s = 0;} else {const d = max - min;s = l > 0.5 ? d / (2 - max - min) : d / (max + min);switch (max) {case r:h = (g - b) / d + (g < b ? 6 : 0);break;case g:h = (b - r) / d + 2;break;case b:h = (r - g) / d + 4;break;}h /= 6;}return {h: Math.round(h * 360),s: Math.round(s * 100),l: Math.round(l * 100),};
};

4. HSL 到 RGB 转换

const hslToRgb = (h, s, l) => {h /= 360;s /= 100;l /= 100;const hue2rgb = (p, q, t) => {if (t < 0) t += 1;if (t > 1) t -= 1;if (t < 1 / 6) return p + (q - p) * 6 * t;if (t < 1 / 2) return q;if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;return p;};let r, g, b;if (s === 0) {r = g = b = l;} else {const q = l < 0.5 ? l * (1 + s) : l + s - l * s;const p = 2 * l - q;r = hue2rgb(p, q, h + 1 / 3);g = hue2rgb(p, q, h);b = hue2rgb(p, q, h - 1 / 3);}return {r: Math.round(r * 255),g: Math.round(g * 255),b: Math.round(b * 255),};
};

5. RGB 到 HSV 转换

const rgbToHsv = (r, g, b) => {r /= 255;g /= 255;b /= 255;const max = Math.max(r, g, b);const min = Math.min(r, g, b);const d = max - min;let h,s,v = max;s = max === 0 ? 0 : d / max;if (max === min) {h = 0;} else {switch (max) {case r:h = (g - b) / d + (g < b ? 6 : 0);break;case g:h = (b - r) / d + 2;break;case b:h = (r - g) / d + 4;break;}h /= 6;}return {h: Math.round(h * 360),s: Math.round(s * 100),v: Math.round(v * 100),};
};

6. RGB 到 CMYK 转换

const rgbToCmyk = (r, g, b) => {r /= 255;g /= 255;b /= 255;const k = 1 - Math.max(r, g, b);const c = (1 - r - k) / (1 - k);const m = (1 - g - k) / (1 - k);const y = (1 - b - k) / (1 - k);return {c: Math.round(c * 100),m: Math.round(m * 100),y: Math.round(y * 100),k: Math.round(k * 100),};
};

完整源码

import { useState, useEffect } from "react";export default function ColorConversion() {const [colorInput, setColorInput] = useState("#ff6b6b");const [colorFormats, setColorFormats] = useState({hex: "#ff6b6b",rgb: { r: 255, g: 107, b: 107 },hsl: { h: 0, s: 100, l: 71 },hsv: { h: 0, s: 58, v: 100 },cmyk: { c: 0, m: 58, y: 58, k: 0 },rgba: { r: 255, g: 107, b: 107, a: 1 },hsla: { h: 0, s: 100, l: 71, a: 1 },});// 颜色转换函数const hexToRgb = (hex) => {// 支持 3 位 HEX 缩写,如 #000, #fffif (/^#?([a-f\d])([a-f\d])([a-f\d])$/i.test(hex)) {const result = /^#?([a-f\d])([a-f\d])([a-f\d])$/i.exec(hex);return {r: parseInt(result[1] + result[1], 16),g: parseInt(result[2] + result[2], 16),b: parseInt(result[3] + result[3], 16),};}// 支持 6 位 HEX,如 #000000, #ffffffconst result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);return result? {r: parseInt(result[1], 16),g: parseInt(result[2], 16),b: parseInt(result[3], 16),}: null;};const rgbToHex = (r, g, b) => {return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);};const rgbToHsl = (r, g, b) => {r /= 255;g /= 255;b /= 255;const max = Math.max(r, g, b);const min = Math.min(r, g, b);let h,s,l = (max + min) / 2;if (max === min) {h = s = 0;} else {const d = max - min;s = l > 0.5 ? d / (2 - max - min) : d / (max + min);switch (max) {case r:h = (g - b) / d + (g < b ? 6 : 0);break;case g:h = (b - r) / d + 2;break;case b:h = (r - g) / d + 4;break;}h /= 6;}return {h: Math.round(h * 360),s: Math.round(s * 100),l: Math.round(l * 100),};};const hslToRgb = (h, s, l) => {h /= 360;s /= 100;l /= 100;const hue2rgb = (p, q, t) => {if (t < 0) t += 1;if (t > 1) t -= 1;if (t < 1 / 6) return p + (q - p) * 6 * t;if (t < 1 / 2) return q;if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;return p;};let r, g, b;if (s === 0) {r = g = b = l;} else {const q = l < 0.5 ? l * (1 + s) : l + s - l * s;const p = 2 * l - q;r = hue2rgb(p, q, h + 1 / 3);g = hue2rgb(p, q, h);b = hue2rgb(p, q, h - 1 / 3);}return {r: Math.round(r * 255),g: Math.round(g * 255),b: Math.round(b * 255),};};const rgbToHsv = (r, g, b) => {r /= 255;g /= 255;b /= 255;const max = Math.max(r, g, b);const min = Math.min(r, g, b);const d = max - min;let h,s,v = max;s = max === 0 ? 0 : d / max;if (max === min) {h = 0;} else {switch (max) {case r:h = (g - b) / d + (g < b ? 6 : 0);break;case g:h = (b - r) / d + 2;break;case b:h = (r - g) / d + 4;break;}h /= 6;}return {h: Math.round(h * 360),s: Math.round(s * 100),v: Math.round(v * 100),};};const rgbToCmyk = (r, g, b) => {r /= 255;g /= 255;b /= 255;const k = 1 - Math.max(r, g, b);const c = (1 - r - k) / (1 - k);const m = (1 - g - k) / (1 - k);const y = (1 - b - k) / (1 - k);return {c: Math.round(c * 100),m: Math.round(m * 100),y: Math.round(y * 100),k: Math.round(k * 100),};};// 更新所有颜色格式const updateColorFormats = (input) => {let rgb;// 检测输入格式并转换为RGBif (input.startsWith("#")) {rgb = hexToRgb(input);} else if (input.startsWith("rgb")) {const match = input.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);if (match) {rgb = {r: parseInt(match[1]),g: parseInt(match[2]),b: parseInt(match[3]),};}} else if (input.startsWith("hsl")) {const match = input.match(/hsla?\((\d+),\s*(\d+)%,\s*(\d+)%(?:,\s*([\d.]+))?\)/);if (match) {rgb = hslToRgb(parseInt(match[1]),parseInt(match[2]),parseInt(match[3]));}}if (rgb) {const hex = rgbToHex(rgb.r, rgb.g, rgb.b);const hsl = rgbToHsl(rgb.r, rgb.g, rgb.b);const hsv = rgbToHsv(rgb.r, rgb.g, rgb.b);const cmyk = rgbToCmyk(rgb.r, rgb.g, rgb.b);setColorFormats({hex,rgb,hsl,hsv,cmyk,rgba: { ...rgb, a: 1 },hsla: { ...hsl, a: 1 },});}};useEffect(() => {updateColorFormats(colorInput);}, [colorInput]);const copyToClipboard = (text) => {navigator.clipboard.writeText(text);};const ColorFormatCard = ({ title, format, copyText }) => (<div className="bg-white rounded-lg shadow-md p-3 sm:p-4 border border-gray-200"><h3 className="text-base sm:text-lg font-semibold text-gray-800 mb-2">{title}</h3><div className="flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-0"><code className="text-xs sm:text-sm bg-gray-100 px-2 py-1 rounded flex-1 font-mono break-all">{format}</code><buttononClick={() => copyToClipboard(copyText)}className="bg-blue-500 hover:bg-blue-600 text-white px-3 py-1 rounded text-xs sm:text-sm transition-colors whitespace-nowrap">复制</button></div></div>);return (<div className="min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100 py-8"><div className="container mx-auto px-4 max-w-6xl"><div className="text-center mb-8"><h1 className="text-4xl font-bold text-gray-800 mb-4">颜色转换工具</h1><p className="text-gray-600 text-lg">支持多种颜色格式的相互转换</p></div>{/* 颜色输入区域 */}<div className="bg-white rounded-xl shadow-lg p-6 mb-8"><div><label className="block text-sm font-medium text-gray-700 mb-2">输入颜色值</label><div className="flex items-center gap-3"><inputtype="text"value={colorInput}onChange={(e) => setColorInput(e.target.value)}placeholder="输入 HEX、RGB、HSL 等颜色值"className="flex-1 px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"/><divclassName="w-12 h-12 rounded-lg border-2 border-gray-300 shadow-sm flex-shrink-0"style={{ backgroundColor: colorFormats.hex }}></div></div></div></div>{/* 颜色格式转换结果 */}<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 sm:gap-6"><ColorFormatCardtitle="HEX 颜色"format={colorFormats.hex}copyText={colorFormats.hex}/><ColorFormatCardtitle="RGB 颜色"format={`rgb(${colorFormats.rgb.r}, ${colorFormats.rgb.g}, ${colorFormats.rgb.b})`}copyText={`rgb(${colorFormats.rgb.r}, ${colorFormats.rgb.g}, ${colorFormats.rgb.b})`}/><ColorFormatCardtitle="RGBA 颜色"format={`rgba(${colorFormats.rgba.r}, ${colorFormats.rgba.g}, ${colorFormats.rgba.b}, ${colorFormats.rgba.a})`}copyText={`rgba(${colorFormats.rgba.r}, ${colorFormats.rgba.g}, ${colorFormats.rgba.b}, ${colorFormats.rgba.a})`}/><ColorFormatCardtitle="HSL 颜色"format={`hsl(${colorFormats.hsl.h}, ${colorFormats.hsl.s}%, ${colorFormats.hsl.l}%)`}copyText={`hsl(${colorFormats.hsl.h}, ${colorFormats.hsl.s}%, ${colorFormats.hsl.l}%)`}/><ColorFormatCardtitle="HSLA 颜色"format={`hsla(${colorFormats.hsla.h}, ${colorFormats.hsla.s}%, ${colorFormats.hsla.l}%, ${colorFormats.hsla.a})`}copyText={`hsla(${colorFormats.hsla.h}, ${colorFormats.hsla.s}%, ${colorFormats.hsla.l}%, ${colorFormats.hsla.a})`}/><ColorFormatCardtitle="HSV 颜色"format={`hsv(${colorFormats.hsv.h}, ${colorFormats.hsv.s}%, ${colorFormats.hsv.v}%)`}copyText={`hsv(${colorFormats.hsv.h}, ${colorFormats.hsv.s}%, ${colorFormats.hsv.v}%)`}/><ColorFormatCardtitle="CMYK 颜色"format={`cmyk(${colorFormats.cmyk.c}%, ${colorFormats.cmyk.m}%, ${colorFormats.cmyk.y}%, ${colorFormats.cmyk.k}%)`}copyText={`cmyk(${colorFormats.cmyk.c}%, ${colorFormats.cmyk.m}%, ${colorFormats.cmyk.y}%, ${colorFormats.cmyk.k}%)`}/></div>{/* 使用说明 */}<div className="mt-8 sm:mt-12 bg-white rounded-xl shadow-lg p-4 sm:p-6"><h2 className="text-xl sm:text-2xl font-bold text-gray-800 mb-4">使用说明</h2><div className="grid grid-cols-1 lg:grid-cols-2 gap-4 sm:gap-6"><div><h3 className="text-lg font-semibold text-gray-700 mb-2">支持的输入格式:</h3><ul className="space-y-2 text-gray-600"><li>• HEX: #ff6b6b 或 #f66</li><li>• HEX 缩写: #000, #fff, #abc</li><li>• RGB: rgb(255, 107, 107)</li><li>• RGBA: rgba(255, 107, 107, 0.8)</li><li>• HSL: hsl(0, 100%, 71%)</li><li>• HSLA: hsla(0, 100%, 71%, 0.8)</li></ul></div><div><h3 className="text-lg font-semibold text-gray-700 mb-2">输出格式:</h3><ul className="space-y-2 text-gray-600"><li>• HEX 十六进制</li><li>• RGB/RGBA 红绿蓝</li><li>• HSL/HSLA 色相饱和度亮度</li><li>• HSV 色相饱和度明度</li><li>• CMYK 青品黄黑</li></ul></div></div></div></div></div>);
}

React 各颜色转换方法、颜色值换算工具HEX、RGB/RGBA、HSL/HSLA、HSV、CMYK - 高质量源码分享平台-免费下载各类网站源码与模板及前沿动态资讯

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.pswp.cn/bicheng/87827.shtml
繁体地址,请注明出处:http://hk.pswp.cn/bicheng/87827.shtml
英文地址,请注明出处:http://en.pswp.cn/bicheng/87827.shtml

如若内容造成侵权/违法违规/事实不符,请联系英文站点网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

开关电源抄板学习

一、实物 输入220V&#xff0c;输出12V5A 二、拍照并使用PS矫正 用卡尺测量下PCB的尺寸&#xff0c;在PS中作为画布。 用相机拍下照片&#xff0c;导入到PS中&#xff0c;用拉伸工具对图片进行矫正处理&#xff0c;并拉伸到和画布一样大小。 三、打开嘉立创EDA&#xff0c;导…

大数据在UI前端的应用探索:基于用户行为分析的产品优化策略

hello宝子们...我们是艾斯视觉擅长ui设计、前端开发、数字孪生、大数据、三维建模、三维动画10年经验!希望我的分享能帮助到您!如需帮助可以评论关注私信我们一起探讨!致敬感谢感恩! 一、引言&#xff1a;用户行为分析重构产品优化的技术逻辑 在数字化产品体验竞争日益激烈的今…

优化 WebSocket 实现单例连接用于打印【待测试 】

class PrinterWebSocket { constructor(url) { if (PrinterWebSocket.instance) { return PrinterWebSocket.instance; } this.url url; this.socket null; this.queue []; // 打印任务队列 this.isConnecting false; this.retry…

Spring Cloud Alibaba/Spring Boot整合华为云存储实例(REST API方式)

一个小作业&#xff0c;初次尝试华为云存储&#xff0c;一点分享 原项目采用Spring Cloud Alibaba微服务技术、Spring Boot框架技术、VueJS前端框架开发技术&#xff0c;nacos注册中心&#xff0c;数据库为mysql 下面看一下没有运用云存储的原项目&#xff08;可跳过&#xf…

Petalinux工程如何离线编译

目录 一.下载离线包 1.1 共享状态缓存包&#xff1a;sstate-cache 1.1.1 进入官网打开Petalinux工具网页 1.1.2 找到相应的Petalinux版本 1.1.3 根据平台下载 1.2 下载downloads源码包 1.3 open_components源码包 二.解压 2.1 sstate-cache 2.2 downloads源码包 2.3…

w446数字化农家乐管理平台的设计与实现

&#x1f64a;作者简介&#xff1a;多年一线开发工作经验&#xff0c;原创团队&#xff0c;分享技术代码帮助学生学习&#xff0c;独立完成自己的网站项目。 代码可以查看文章末尾⬇️联系方式获取&#xff0c;记得注明来意哦~&#x1f339;赠送计算机毕业设计600个选题excel文…

AWS WebRTC:通过shell分析viewer端日志文件

在并发过程中,每个viewer会产生一个对应的日志文件,日志文件名为: viewer_channel_index_20250626_030943_145.logviewer端日志比master端日志文件数量多,比例大概是5:1,有1个master就会有5个viewer,每个viewer对应一个日志文件。 我要统计的是从启动viewer到出第一帧视…

时间转换——借助时间模块time

两种时间戳类型 例如s11704879917000 1、13位的时间戳&#xff1a;单位&#xff08;毫秒&#xff09; &#xff08;1&#xff09;毫秒变成秒&#xff0c;1s1000ms&#xff0c;s1/1000&#xff08;秒&#xff09; &#xff08;2&#xff09;加载时间 times time.localtime(…

LabVIEW MathScript薄板热流模拟

热流模拟是热设计关键环节&#xff0c;传统工具精准但开发周期长&#xff0c;本 VI 利用 LabVIEW 优势&#xff0c;面向工程师快速验证需求&#xff0c;在初步方案迭代、教学演示等场景更具效率&#xff0c;为热分析提供轻量化替代路径&#xff0c;后续可结合专业工具&#xff…

为什么大语言模型训练和推理中越来越多地使用 bfloat16?

随着大语言模型&#xff08;LLM&#xff09;的参数规模从几十亿&#xff08;B&#xff09;飙升到千亿&#xff08;T&#xff09;级别&#xff0c;模型的训练与推理效率变得尤为关键。为了在保证精度的同时节省显存、加快运算&#xff0c;混合精度训练&#xff08;Mixed Precisi…

暴力破解漏洞与命令执行漏洞

在当今的互联网世界中&#xff0c;网络安全威胁无处不在。对于Java后端开发者而言&#xff0c;了解常见的Web漏洞及其防护措施至关重要。本文将探讨两种常见的安全漏洞&#xff1a;暴力破解漏洞&#xff08;Brute Force&#xff09;和命令执行漏洞&#xff08;Command Injectio…

HDFS Java API 开发指南:从基础操作到高级应用

HDFS (Hadoop Distributed File System) 作为大数据生态的核心存储系统&#xff0c;提供了分布式、高容错、高吞吐量的数据存储能力。通过 Java API 操作 HDFS 是开发大数据应用的基础技能。本文将基于你的笔记&#xff0c;详细解析 HDFS Java API 的使用方法&#xff0c;并提供…

区块链技术核心组件及应用架构的全面解析

区块链技术是一套融合密码学、分布式系统与经济激励的复合型技术体系&#xff0c;以下是其核心组件及应用架构的全面解析&#xff1a;一、区块链核心技术栈 1. 分布式账本技术&#xff08;DLT&#xff09; 核心原理&#xff1a;多节点共同维护不可篡改的数据链数据结构&#xf…

golang 协程 如何中断和恢复

Go语言通知协程退出(取消)的几种方式 - 知乎 GoLang之goroutine底层系列二(goroutine的创建、让出、恢复)_golang goroutine-CSDN博客 在 Go 语言中&#xff0c;协程&#xff08;也称为 goroutine&#xff09;是通过 go 关键字启动的轻量级线程。由于 goroutine 的调度是由 Go…

ARMv8 创建3级页表示例

最近在研究arm v8页表创建过程&#xff0c;顺带做了一个如下形式的页表&#xff0c; // level 1 table, 4 entries: // 0000 0000 - 3FFF FFFF, 1GB block, DDR // 4000 0000 - 7FFF FFFF, 1GB block, DDR // 8000 0000 - BFFF FFFF, 1GB block, DDR // C000 0000 - FFFF FFFF…

迁港战平 精神可胜国足

迁港战平可胜国足 江苏省城市足球联赛第6轮&#xff0c;宿迁队主场迎战连云港队。比赛中&#xff0c;宿迁队由张栋和高驰各入一球&#xff0c;连云港队则凭借穆家鑫与李团杰的进球连扳两城。最终双方以2比2握手言和。 第38分钟&#xff0c;张栋角球进攻中无人盯防推射破门&…

408第三季part2 - 计算机网络 - ip分布首部格式与分片

理解 好好看一下这个图 每行是4B&#xff0c;首部也不一定是20B&#xff0c;还有可选字段&#xff0c;可以变的更大 然后我们先看一下概念 然后这个生存时间每路过一个路由器就会扣1滴血 比如一开始是13&#xff0c;经过r1r2r3到B会变成10 但如果是2&#xff0c;经过第二个路…

详解String类不可变的底层原理

String类 String的基本特性 不可变性: String 对象一旦创建就不能被修改&#xff0c;所有看似修改的操作实际上都是创建新的 String 对象final类: String 类被声明为 final&#xff0c;不能被继承基于字符数组: 内部使用final char value[]存储字符数据(Java9以后改为byte[] …

GIT: 一个用于视觉与语言的生成式图像到文本转换 Transformer

摘要 在本文中&#xff0c;我们设计并训练了一个生成式图像到文本转换 Transformer——GIT&#xff0c;以统一视觉-语言任务&#xff0c;如图像/视频字幕生成和问答。虽然生成式模型在预训练和微调之间提供了一致的网络架构&#xff0c;但现有工作通常包含复杂的结构&#xff…

20250706-9-Docker快速入门(下)-Docker在线答疑_笔记

一、Kubernetes核心概念与集群搭建 1. 在线答疑 &#xfeff; 1&#xff09;答疑Docker需要掌握到什么程度 学习目标&#xff1a;达到入门水平即可&#xff0c;重点掌握第一章Docker入门视频内容学习建议&#xff1a;预习时间约3-4小时&#xff0c;建议吸收视频内容的80%学…