Skip to content

Commit e120122

Browse files
committed
feat(Constants): add HolographicStyle
1 parent ee57528 commit e120122

File tree

4 files changed

+47
-2
lines changed

4 files changed

+47
-2
lines changed

packages/discord.js/src/managers/RoleManager.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ class RoleManager extends CachedManager {
115115
* @property {ColorResolvable} [secondaryColor] The secondary color of the role.
116116
* This will make the role a gradient between the other provided colors
117117
* @property {ColorResolvable} [tertiaryColor] The tertiary color of the role.
118-
* When sending `tertiaryColor` the API enforces the role color to be a holographic style with values of `primaryColor = 11127295`, `secondaryColor = 16759788`, and `tertiaryColor = 16761760`
118+
* When sending `tertiaryColor` the API enforces the role color to be a holographic style with values of `primaryColor = 11127295`, `secondaryColor = 16759788`, and `tertiaryColor = 16761760`.
119+
* These values are available as a constant: `Constants.HolographicStyle`
119120
*/
120121

121122
/**
@@ -157,6 +158,19 @@ class RoleManager extends CachedManager {
157158
* })
158159
* .then(console.log)
159160
* .catch(console.error);
161+
* @example
162+
* // Create a role with holographic colors
163+
* guild.roles.create({
164+
* name: 'Holographic Role',
165+
* reason: 'Creating a role with holographic effect',
166+
* colors: {
167+
* primaryColor: Constants.HolographicStyle.Primary,
168+
* secondaryColor: Constants.HolographicStyle.Secondary,
169+
* tertiaryColor: Constants.HolographicStyle.Tertiary,
170+
* },
171+
* })
172+
* .then(console.log)
173+
* .catch(console.error);
160174
*/
161175
async create(options = {}) {
162176
let { permissions, icon } = options;

packages/discord.js/src/structures/Role.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ class Role extends Base {
6363
* @property {?number} secondaryColor The secondary color of the role.
6464
* This will make the role a gradient between the other provided colors
6565
* @property {?number} tertiaryColor The tertiary color of the role.
66-
* When sending `tertiaryColor` the API enforces the role color to be a holographic style with values of `primaryColor = 11127295`, `secondaryColor = 16759788`, and `tertiaryColor = 16761760`
66+
* When sending `tertiaryColor` the API enforces the role color to be a holographic style with values of `primaryColor = 11127295`, `secondaryColor = 16759788`, and `tertiaryColor = 16761760`.
67+
* These values are available as a constant: `Constants.HolographicStyle`
6768
*/
6869

6970
if ('colors' in data) {
@@ -338,6 +339,15 @@ class Role extends Base {
338339
* role.setColors({ primaryColor: '#FF0000', secondaryColor: '#00FF00', tertiaryColor: '#0000FF' })
339340
* .then(updated => console.log(`Set colors of role to ${updated.colors}`))
340341
* .catch(console.error);
342+
* @example
343+
* // Set holographic colors using constants
344+
* role.setColors({
345+
* primaryColor: Constants.HolographicStyle.Primary,
346+
* secondaryColor: Constants.HolographicStyle.Secondary,
347+
* tertiaryColor: Constants.HolographicStyle.Tertiary,
348+
* })
349+
* .then(updated => console.log(`Set holographic colors for role ${updated.name}`))
350+
* .catch(console.error);
341351
*/
342352
async setColors(colors, reason) {
343353
return this.edit({ colors, reason });

packages/discord.js/src/util/Constants.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,21 @@ exports.StickerFormatExtensionMap = {
222222
[StickerFormatType.GIF]: ImageFormat.GIF,
223223
};
224224

225+
/**
226+
* Holographic color values for role styling.
227+
* When using `tertiaryColor`, the API enforces these specific values for holographic effect.
228+
*
229+
* @typedef {Object} HolographicStyle
230+
* @property {number} Primary 11127295 (0xA9FFFF)
231+
* @property {number} Secondary 16759788 (0xFFCCCC)
232+
* @property {number} Tertiary 16761760 (0xFFE0A0)
233+
*/
234+
exports.HolographicStyle = {
235+
Primary: 11_127_295,
236+
Secondary: 16_759_788,
237+
Tertiary: 16_761_760,
238+
};
239+
225240
/**
226241
* @typedef {Object} Constants Constants that can be used in an enum or object-like way.
227242
* @property {number} MaxBulkDeletableMessageAge Max bulk deletable message age
@@ -232,4 +247,5 @@ exports.StickerFormatExtensionMap = {
232247
* @property {VoiceBasedChannelTypes} VoiceBasedChannelTypes The types of channels that are voice-based
233248
* @property {SelectMenuTypes} SelectMenuTypes The types of components that are select menus.
234249
* @property {Object} StickerFormatExtensionMap A mapping between sticker formats and their respective image formats.
250+
* @property {HolographicStyle} HolographicStyle Holographic color values for role styling.
235251
*/

packages/discord.js/typings/index.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3820,6 +3820,11 @@ export type UndeletableMessageType =
38203820

38213821
export const Constants: {
38223822
GuildTextBasedChannelTypes: GuildTextBasedChannelTypes[];
3823+
HolographicStyle: {
3824+
Primary: 11_127_295;
3825+
Secondary: 16_759_788;
3826+
Tertiary: 16_761_760;
3827+
};
38233828
MaxBulkDeletableMessageAge: 1_209_600_000;
38243829
NonSystemMessageTypes: NonSystemMessageType[];
38253830
SelectMenuTypes: SelectMenuType[];

0 commit comments

Comments
 (0)