mattermost-mobile/app/utils/colors.js
Harrison Healey d0481605fb Add ability to post messages (#158)
* Fixed copyright date

* Removed unnecessary components folder from channel scene

* Added initial version of post textbox

* Moved getTheme into a proper selector

* Moved ChannelHeader into its own component

* Flipped post list so that the most recent posts appear at the bottom

* Moved post textbox value into redux view store

* Switched new components from PureRenderMixin to React.PureComponent
2017-01-13 10:40:00 -03:00

24 lines
700 B
JavaScript

// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
export function changeOpacity(oldColor, opacity) {
let color = oldColor;
if (color[0] === '#') {
color = color.slice(1);
}
if (color.length === 3) {
const tempColor = color;
color = '';
color += tempColor[0] + tempColor[0];
color += tempColor[1] + tempColor[1];
color += tempColor[2] + tempColor[2];
}
const r = parseInt(color.substring(0, 2), 16);
const g = parseInt(color.substring(2, 4), 16);
const b = parseInt(color.substring(4, 6), 16);
return 'rgba(' + r + ',' + g + ',' + b + ',' + opacity + ')';
}